W3C home > Mailing lists > Public > public-qt-comments@w3.org > June 2010

[Bug 9840] New: [XSLT 2.0] xsl:number level="single" has different behaviour to XSLT 1.0

From: <bugzilla@jessica.w3.org>
Date: Thu, 03 Jun 2010 10:52:17 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-9840-523@http.www.w3.org/Bugs/Public/>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=9840

           Summary: [XSLT 2.0] xsl:number level="single" has different
                    behaviour to XSLT 1.0
           Product: XPath / XQuery / XSLT
           Version: Recommendation
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLT 2.0
        AssignedTo: mike@saxonica.com
        ReportedBy: nick@cbcl.co.uk
         QAContact: public-qt-comments@w3.org


I believe the numbering behaviour described in XSLT 2.0 is different to that in
XSLT 1. It's unclear if this is intentional - it is show up by numbering63 in
the test suite.

Consider:

<doc>
  <a>
    <title/>
  </a>
</doc>

On the title node evaluate:

<xsl:number from="a" count="a" level="single"/>

>From the XSLT 2 spec:

$S := <title/>

$A := $S/ancestor-or-self::node()[matches-count(.)][1]
   := <a>

$F := $S/ancestor-or-self::node()[matches-from(.)][1]
   := <a>

$AF := $A[ancestor-or-self::node()[. is $F]]
    := <a>

If $AF is empty, return the empty sequence, ()
Otherwise return the value of:
1 + count($AF/preceding-sibling::node()[matches-count(.)])

There for the result is 1


>From XSLT 1:

When level="single", it goes up to the first node in the ancestor-or-self axis
that matches the count pattern, and constructs a list of length one containing
one plus the number of preceding siblings of that ancestor that match the count
 pattern. If there is no such ancestor, it constructs an empty list. If the
from attribute is specified, then the only ancestors that are searched are
those that are descendants of the nearest ancestor that matches the from
pattern. Preceding siblings has the same meaning here as with the
preceding-sibling axis.

I believe the sentence "If the from attribute is specified, then the only
ancestors that are searched are those that are descendants of the nearest
ancestor that matches the from pattern." is describing the equivalent of:

$AF := $A[ancestor::node()[. is $F]]
    := ()

Hence resulting in the output being empty-sequence

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Thursday, 3 June 2010 10:52:19 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:31 UTC