[xsl] Finding the "correct" context node in a for-each with multiple predicates

Subject: [xsl] Finding the "correct" context node in a for-each with multiple predicates
From: "Ericsson, Mikael" <Mikael.Ericsson@xxxxxxxxx>
Date: Mon, 7 Jul 2003 17:24:37 +0200
Hi,
 
Let's say there's an XML with a list of spots:
 
<spot name="Alpha" value="Kilo"/>
<spot name="Bravo" value="Lima"/>
...
 
And another XML-file with a number of "foo", each having a number of children "bar":
<foo location="Kilo">
    <bar type="Alpha"/>
        ...
</foo>
...
 
Now I want to to work through the set of nodes in the spot list that match the select I'm trying to describe below:
 
<xsl:for-each select="spot[foo[@location=<attribute value from spot>]/bar[@type=<attribute name from spot>]]">
 
So the question is how do I access the attributes of the spot currently under test? I know that I could write e.g. 
 
<xsl:for-each select="spot[@name=foo[@location]"> 
 
if it was just one attribute that I wanted to match, but my expression is more complex than that (even the expression here is simplified).
I've tried 
 
<xsl:for-each select="spot[foo[@location=./@value]/bar[@type=./@name]]"> 
 
without success and I think that is because that expression searches for a value attribute of foo and a name attribute of bar, respectively.
regards,
Mike

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread