W3C home > Mailing lists > Public > public-qt-comments@w3.org > November 2015

[Bug 29305] New: [XT30TS] number-3501, 3229, 4001

From: <bugzilla@jessica.w3.org>
Date: Wed, 25 Nov 2015 12:07:00 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-29305-523@http.www.w3.org/Bugs/Public/>

            Bug ID: 29305
           Summary: [XT30TS]  number-3501, 3229, 4001
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLT 3.0 Test Suite
          Assignee: abel.online@xs4all.nl
          Reporter: tim@cbcl.co.uk
        QA Contact: public-qt-comments@w3.org
  Target Milestone: ---

Having concurred with these results for some years, after re-implementing
xsl:number carefully, I think the expected results are incorrect.  

Taking as an example nmber-3501, the input starts:

<!-- Test for source tree numbering -->
  <title>Test for source tree numbering</title>
    <title>First Chapter</title>

and the transformation applies

<xsl:template match="chapter//title">
  <xsl:number level="multiple" from="chapter"
      format="A.1.a. "/>
  <xsl:value-of select="."/><xsl:text>

and the expected result given for the first chapter/title above is ". First

Following the rules for xsl:number level="multiple"

S = the title element with content "First Chapter"
F = first chapter node in document (/doc[1]/chapter[1])
A = first chapter node in document (/doc[1]/chapter[1])
AF = first chapter node in document (/doc[1]/chapter[1])


 for $af in $AF
  return 1+count($af/preceding-sibling::node()[local:matches-count(.)])

gives 1 + count(()), i.e. 1, which should format as "A." (which seems correct

The following XQuery might help...

declare function local:matches-count($arg)
  typeswitch ($arg)
  case element(chapter) return true()
  case element(section) return true()
  case element(subsection) return ($arg/../subsection[1] is $arg)
  default return false()

declare function local:matches-from($arg)
  typeswitch ($arg)
  case element(chapter) return true()
  default return root($arg) is $arg

let $S := /doc[1]/chapter[1]/title[1]
let $A := $S/ancestor-or-self::node()[local:matches-count(.)]
let $F := $S/ancestor-or-self::node()[local:matches-from(.)][1]
let $AF := $A[ancestor-or-self::node()[. is $F]]
  "S = ", $S,
  "A = ", $A,
  "F = ", $F,
  "AF = ", $AF,

  for $af in $AF
  return 1+count($af/preceding-sibling::node()[local:matches-count(.)])

You are receiving this mail because:
You are the QA Contact for the bug.
Received on Wednesday, 25 November 2015 12:07:47 UTC

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