[xslt] key() bug?



I believe the output of this stylesheet (with the same stylesheet as input)
should be:

Mode of FOO is input
Mode of FOO is fiddled

But xsltproc gives

Mode of FOO is input
Mode of FOO is input

Known bug?

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:exsl="http://exslt.org/common";
                version="1.0">

<xsl:key name="tmpls" match="xsl:template" use="@name"/>

<xsl:template match="/">
  <xsl:message>
    <xsl:text>Mode of FOO is </xsl:text>
    <xsl:value-of select="key('tmpls', 'FOO')/@mode"/>
  </xsl:message>

  <xsl:variable name="fiddle">
    <xsl:apply-templates select="//xsl:template"/>
  </xsl:variable>

  <xsl:apply-templates select="exsl:node-set($fiddle)" mode="faddle"/>
</xsl:template>

<xsl:template match="xsl:template">
  <xsl:copy>
    <xsl:copy-of select="@*"/>
    <xsl:attribute name="mode">fiddled</xsl:attribute>
  </xsl:copy>
</xsl:template>

<xsl:template match="/" mode="faddle">
  <xsl:message>
    <xsl:text>Mode of FOO is </xsl:text>
    <xsl:value-of select="key('tmpls', 'FOO')/@mode"/>
  </xsl:message>
</xsl:template>

<xsl:template name="FOO" mode="input"/>

</xsl:stylesheet>

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com> | Success is relative; it is what we make
http://nwalsh.com/            | of the mess we have made of things.--T.
                              | S. Eliot

PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]