xsl-list
[Top] [All Lists]

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

2003-07-07 08:24:37
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[(_at_)location=<attribute value from 
spot>]/bar[(_at_)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[(_at_)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[(_at_)location=(_dot_)/@value]/bar[(_at_)type=(_dot_)/@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



<Prev in Thread] Current Thread [Next in Thread>