xsl-list
[Top] [All Lists]

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

2008-05-09 14:16:40
I'm pretty sure that you need to something like:

<xsl:variable name="festival" select="."/>
<xsl:for-each select="//Artist[(_at_)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(_at_)musictoday(_dot_)com [mailto:Trish(_at_)musictoday(_dot_)com]
Sent: Thursday, May 08, 2008 11:50 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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[(_at_)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.



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--