[xsl] xsl:number from="/" level="any"

Subject: [xsl] xsl:number from="/" level="any"
From: Deborah Pickett <debbiep-list-xsl@xxxxxxxxxx>
Date: Fri, 09 Mar 2007 22:42:13 +1100
This is in the context of xsl:number with @level="any".

Reading the XSLT 2.0 recommendation it looks like @from is allowed to be "/" to indicate a document node.

Yet I get empty sequences whenever I try it with Saxon 8.8.

I get the behaviour I expect with @from="/*".

Here's an example, which uses processing instructions to show a case where / has more than one child.

Document:
<?xml version="1.0" encoding="UTF-8"?>
<?thing?>
<top>
    <?thing?>
    <child>
        <?thing?>
        <child><?thing?></child>
    </child>
    <child>
        <?thing?>
    </child>
</top>
<?thing?>

Stylesheet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="2.0">


<xsl:template match="processing-instruction(thing)">
<xsl:message>
<xsl:text>This thing gets xsl:number "</xsl:text>
<xsl:number count="processing-instruction('thing')" from="/" level="any"/>
<xsl:text>" from / and xsl:number "</xsl:text>
<xsl:number count="processing-instruction('thing')" from="/*" level="any"></xsl:number>
<xsl:text>" from /*.</xsl:text>
</xsl:message>
<xsl:apply-templates></xsl:apply-templates>
</xsl:template>
</xsl:stylesheet>


Output:
This thing gets xsl:number "" from / and xsl:number "" from /*.
This thing gets xsl:number "" from / and xsl:number "1" from /*.
This thing gets xsl:number "" from / and xsl:number "2" from /*.
This thing gets xsl:number "" from / and xsl:number "3" from /*.
This thing gets xsl:number "" from / and xsl:number "4" from /*.
This thing gets xsl:number "" from / and xsl:number "5" from /*.

Current Thread