[Bug 1846] New: [XSLT2.0] xsl:number applied to attributes and namespaces

http://www.w3.org/Bugs/Public/show_bug.cgi?id=1846

           Summary: [XSLT2.0] xsl:number applied to attributes and
                    namespaces
           Product: XPath / XQuery / XSLT
           Version: Last Call drafts
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLT 2.0
        AssignedTo: mike@saxonica.com
        ReportedBy: mike@saxonica.com
         QAContact: public-qt-comments@w3.org


If the "from" attribute of xsl:number is omitted, then the effect in XSLT 1.0 is
that numbering (for level="single" and level="multiple") considers the entire
tree. The way we have phrased the rules in 2.0 is subtly different: we say that
if "from" is omitted, the effective value of "from" is the root of the tree, and
the nodes that we consider are those that are descendants-or-self of the root.

The effect of this is that we don't consider attribute and namespace nodes,
except in the special case that the attribute or namespace is parentless. The
consequence is that <xsl:number/> with no "from" or "count", when applied to an
attribute node, returns "1" if the attribute is parentless, and () when it has a
parent. In XSLT 1.0, it always returned "1" (but don't try this in Saxon).

I think the cleanest fix for this would be that instead of considering only
descendants-or-self of $F (the innermost node that matches the "from" pattern),
we should consider all nodes that have $F as an ancestor-or-self (or
equivalently, we should consider descendants-or-self plus their attributes and
namespaces). That is, for level="single" and level="multiple", we should change
the clause

Let $AF be the value of:

   $A intersect ($F/descendant-or-self::node())

to:

Let $AF be the value of

   $A[ancestor-or-self::node()[. is $F]]

 

In practice "from" is more important for level="any". Here the test is [. is $F
or . >> $F], which works fine for attribute and namespace nodes, so this case
does not need to be changed. 

Michael Kay

Received on Monday, 15 August 2005 10:13:04 UTC