This is slightly OT, but I though someone may of come across this problem in
the past.
I am feed an XML feed from some third party in the format;
<selections>
<regions>
<selection>
<id>1</id>
<description>uk</description>
</selection>
<selection>
<id>2</id>
<description>usa</description>
</selection>
</regions>
</selections>
I then want to pick out a specific �selection� element using <id> as a
reference, my preferred method is;
<xsl:for-each select="/selections/regions/*[id=.]">
1-<xsl:value-of select="description"/>
</xsl:for-each>
Unfortunately I cant get this to work, is my syntax wrong?
My second attempt below does work but is messy.
<xsl:variable name="bug" select="."/>
<xsl:for-each select="/selections/regions/*[id=$bug]">
2-<xsl:value-of select="description"/>
</xsl:for-each>
Another solution using indices is below, I don�t like this cos of the
overhead of creating an index for each <selection>
<xsl:key name="dynamic-regions" match="/selections/regions/selection"
use="id"/>
<xsl:for-each select="key('dynamic-regions',.)">
3-<xsl:value-of select="description"/>
</xsl:for-each>
Anybody got any ideas on why the first approach doesn�t work? I�m using
libxml2.5.3, libxslt-1.0.24 (did upgrade to .26 but that rev appears to what
to phrase the contents of my CDATA tags, Grrrrr), LibXML 1.53, LibXSLT 1.52
and AxKit 1.6.1
Any help or pointers gratefully received.