I have an XML document like this:
(p is defined previously)
<p:Players>
<p:Player>
<p:Name>David</p:Name>
<p:Club>
<p:Name>Madrid</p:Name>
</p:Club>
<p:PreviousClubs>
<p:Club><p:Name>Milan</p:Name></p:Club>
<p:Club><p:Name>Manchester</p:Name></p:Club>
</p:PreviousClubs>
</p:Player>
<p:Player>
<p:Name>Alex</p:Name>
<p:Club>
<p:Name>Madrid</p:Name>
</p:Club>
<p:PreviousClubs>
<p:Club><p:Name>Birmingham</p:Name></p:Club>
<p:Club><p:Name>Manchester</p:Name></p:Club>
</p:PreviousClubs>
</p:Player>
<p:Player>
<p:Name>Fred</p:Name>
<p:Club>
<p:Name>Madrid</p:Name>
</p:Club>
<p:PreviousClubs>
<p:Club><p:Name>Milan</p:Name></p:Club>
<p:Club><p:Name>Birmingham</p:Name></p:Club>
</p:PreviousClubs>
</p:Player>
</p:Players>
I'd like to get the Names of all the players who've previously played for a given club.
This is what I have so far, but it isn't picking anything up:
/*[1]/p:Player[p:PreviousClubs/p:Club/p:Name='Manchester']/p:Name/text()
I expect that to return
David
Alex
But I get nothing
Can someone see where I'm going wrong?
The namespace and its prefix of p: is correct - have used elsewhere and its fine. I feel my logic around selecting the particular parent node is wrong...
I need to stick to XSLT 1.0 as its BizTalk driven.