This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 1846 - [XSLT2.0] xsl:number applied to attributes and namespaces
Summary: [XSLT2.0] xsl:number applied to attributes and namespaces
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 2.0 (show other bugs)
Version: Last Call drafts
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-15 09:49 UTC by Michael Kay
Modified: 2005-09-29 12:51 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2005-08-15 09:49:48 UTC
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
Comment 1 Michael Kay 2005-09-15 22:19:31 UTC
The WG agreed to this change at its meeting on 15 September 2005. The spec has
been updated.

Michael Kay