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 8402 - [XSLT 2.1] xsl:number start-at attribute
Summary: [XSLT 2.1] xsl:number start-at attribute
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Recommendation
Hardware: PC Windows NT
: 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: 2009-11-30 15:56 UTC by Michael Kay
Modified: 2011-06-08 20:41 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2009-11-30 15:56:27 UTC
A simple and useful addition to xsl:number would be an attribute

start-at="expression"

to control the first number in the numbering sequence (defaulting to 1).

Useful for example where numbering is to run across the documents in a collection: 

<xsl:iterate select="collection('chapters')">
  <xsl:param name="first-fig" select="1"/>
  <xsl:apply-templates>
    <xsl:with-param name="first-fig" select="$first-fig" tunnel="yes"/>
  </xsl:apply-templates>
  ...
  <xsl:next-iteration>
   <xsl:param name="first-fig" select="$first-fig + count(.//figure)"/>
  </xsl:next-iteration>
</xsl:iterate>

<xsl:template match="figure">
  <xsl:param name="first-fig" tunnel="yes"/>
  Figure <xsl:number level="any" start-at="$first-fig"/>
</xsl:template>

Requirement extrapolated from a question on xsl-list today.
Comment 1 Michael Kay 2010-07-16 11:32:03 UTC
Accepted in principle. Noted that the parameter may be a sequence of integers, one for each level in the numbering hierarchy. Need error conditions if the value is the wrong type, etc.
Comment 2 Michael Kay 2011-03-24 13:45:48 UTC
Status: this feature is in the current draft.
Comment 3 Michael Kay 2011-06-08 20:40:53 UTC
Closing this on the grounds that we have a design in the current working draft that meets the requirements.