On Friday, 21. February 2003 11:54, Mark Cance wrote:
> 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?
The correct usage is: select="/selections/regions/*[id=current()]"
(The reason being, the 'context' node (".") changes with each "/", while XSLT
maintains a separate 'current' node, which only changes on apply-templates or
inside for-each. Consequently, the behaviour you observe is correct.)
--
CU
Joerg
PGP Public Key at http://ich.bin.kein.hoschi.de/~trouble/public_key.asc
PGP Key fingerprint = D34F 57C4 99D8 8F16 E16E 7779 CDDC 41A4 4C48 6F94
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]