[xsl] RE: Finding Nodes That Match Distinct Node Value

Subject: [xsl] RE: Finding Nodes That Match Distinct Node Value
From: Tony Nassar <tnassar@xxxxxxxxxxxxxxxx>
Date: Fri, 9 May 2008 14:16:08 -0700
I'm pretty sure that you need to something like:

<xsl:variable name="festival" select="."/>
<xsl:for-each select="//Artist[@festival = $festival]">
 ...
</xsl:for-each>

"." is evaluated relative to where the you've gotten in the tree by means of
the XPath expression, not to where you were.

-----Original Message-----
From: Trish@xxxxxxxxxxxxxx [mailto:Trish@xxxxxxxxxxxxxx]
Sent: Thursday, May 08, 2008 11:50 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Finding Nodes That Match Distinct Node Value

Hi:

I want to loop through an xml document and get distinct values from an
attribute and then find all sibling nodes that have that attribute
value.

I'm pulling distinct festivals based on @festival within each artist
just fine, but then I want to go back and get all of the Artist info per
festival. It seems like the code I'm using to do this should work, but
it doesn't. I can't change the organization of the xml. I'm trying not
to use keys. I only have access to XSL 1.0 for this project. The line I
need help with is:
<xsl:for-each select="//Artist[@festival = .]">

I'm guessing that the value of "." is lost because I'm beginning at the
top of the document again. I'm certain that one of you has an elegant
solution.

Current Thread