- From: <bugzilla@jessica.w3.org>
- Date: Wed, 25 Nov 2015 12:07:00 +0000
- To: public-qt-comments@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=29305
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 -->
<doc>
<title>Test for source tree numbering</title>
<chapter>
<title>First Chapter</title>
and the transformation applies
<xsl:template match="chapter//title">
<xsl:number level="multiple" from="chapter"
count="chapter|section|subsection[1]"
format="A.1.a. "/>
<xsl:value-of select="."/><xsl:text>
</xsl:text>
</xsl:template>
and the expected result given for the first chapter/title above is ". First
Chapter".
Following the rules for xsl:number level="multiple"
S = the title element with content "First Chapter"
(/doc[1]/chapter[1]/title[1])
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])
so
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
intuitively).
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]]
return
(
"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