Using current() works correctly. Thanks.
Regards,
Rene
2006/6/6, Michael Kay <mike(_at_)saxonica(_dot_)com>:
The value of "." changes inside a predicate. Use current() instead, or an
explicit variable.
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: Rene Ladan [mailto:r(_dot_)c(_dot_)ladan(_at_)gmail(_dot_)com]
> Sent: 06 June 2006 10:56
> To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
> Subject: [xsl] selecting a node inside <xsl:for-each> fails?
>
> Hi,
>
> I'm trying to select a node which has attribute c set to '2',
> but the selection $root//*[(_at_)c=(_dot_)] (where . is an iterator over
> the sequence ('1', '2', '3')) returns nothing instead of node <b>.
> Changing this into $root//*[(_at_)c=string(.)] does not work either.
>
> The 'explicit' expression and the two expressions ('outside' and
> 'direct') after the <xsl:for-each> do work.
>
> Any ideas?
>
> I'm using Saxon B-8.7-Java.
>
> Regards.
> Rene
>
> -- test-select.xml --
>
> <a>
> <b c="2" e="f">
> <g/>
> </b>
> </a>
>
> -- test-select.xsl --
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xsl:variable name="root" as="node()" select="/"/>
> <xsl:template match="*">
> <xsl:variable name="nums" as="xs:string*" select="'1','2','3'"/>
> <xsl:for-each select="$nums">
> value=<xsl:value-of select="."/>
> <xsl:if test=".='2'">found</xsl:if>
> <!--both [(_at_)c=(_dot_)] and [(_at_)c='{.}'] and [(_at_)c=string(.)]
> return nothing-->
> node=<xsl:copy-of select="$root//*[(_at_)c=(_dot_)]"/>
> explicit=<xsl:copy-of select="$root//*[(_at_)c='2']"/><!--ok-->
> </xsl:for-each>
> outside=<xsl:copy-of select="$root//*[(_at_)c='2']"/><!--ok-->
> direct=<xsl:copy-of select="//*[(_at_)c='2']"/><!--ok-->
> </xsl:template>
> </xsl:stylesheet>
>
> --
> GPG fingerprint = E738 5471 D185 7013 0EE0 4FC8 3C1D 6F83 12E1 84F6
> (subkeys.pgp.net)
>
> "It won't fit on the line."
> -- me, 2001
>
> --~------------------------------------------------------------------
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
> To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
> or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
> --~--
>
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--
GPG fingerprint = E738 5471 D185 7013 0EE0 4FC8 3C1D 6F83 12E1 84F6
(subkeys.pgp.net)
"It won't fit on the line."
-- me, 2001
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--