Name

<xsl:number>

Synopsis

This element inserts a formatted integer into the result tree. The value of this number can be determined by the attributes or generated by the XSLT processor. The attributes are described as follows:

value

This attribute contains an XPath expression returning the number to be formatted. If necessary, the number is rounded to the nearest integer. Most commonly, the value attribute is omitted, in which case the number is calculated from the position of the current node in the source document. The position is calculated as specified by the level, count, and from attributes.

count

This attribute contains a pattern that specifies which nodes should be counted at those levels. The default is to count all nodes of the same node type (element, text, attribute, etc.) and name as the current node.

from

This attribute contains a pattern identifying the node from which counting starts; that is, it says which node is number 1.

level

This attribute can be set to single (all preceding siblings of the ancestor of the current node that match the count pattern), multiple (for nested counting of each type of ancestor of the current node that match the count pattern), or any (count all nodes in the document that match the count pattern and precede the current node). The default is single.

format

This attribute determines how the list will be numbered. Format tokens include:

  • 1, 2, 3, 4, 5, 6

  • 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12

  • A, B, C, D...Z, AA, AB, AC...

  • a, b, ...

Get Webmaster in a Nutshell, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.