<xsl:for-each select="borders">
<xsl:value-of select="//country[@id=@country]/@name"/>
</xsl:for-each>
[web] Small XSL problem
I'm having some trouble getting this to work:
I'm trying to display all the "country"'s "@name" attribute which has their "@id" attribute equal to the "border"'s "@country" attribute.
I hope I've made myself clear :)
note each "country" has a unique "@id" attribute, so there should display one country/@name per loop in the for-each.
thx
In:
//country[@id=@country]/@name
The country attribute '@country' is taken from the <country> element, not the <borders> element. What you need to do is, just before the value-of, assign the value of the <borders>'s @country attribute to an xsl:variable, then use that variable in the value-of.
See xsl:variable at http://www.w3.org/TR/xslt#variables
//country[@id=@country]/@name
The country attribute '@country' is taken from the <country> element, not the <borders> element. What you need to do is, just before the value-of, assign the value of the <borders>'s @country attribute to an xsl:variable, then use that variable in the value-of.
See xsl:variable at http://www.w3.org/TR/xslt#variables
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement