Name
<xsl:number>
Displays a number. It is most often used to number parts of a document, although it can also be used to format a numeric value.
Category
Instruction.
Required Attributes
None.
Optional Attributes
countThe
countattribute is an XPath pattern that defines what should be counted. If thecountattribute isn’t specified, it counts nodes with the same name as the current node.levelThis attribute defines what levels of the source tree should be considered when numbering elements. The three valid values for this attribute are
single,multiple, andany:singleCounts items at one level only. The XSLT processor goes to the first node in the
ancestor-or-selfaxis that matches thecountattribute, and then counts that node plus all its preceding siblings that also match thecountattribute. This is the default value.multipleCounts items at multiple levels. The XSLT processor looks at all the ancestors of the current node and at the current node itself, and then it selects all nodes that match the
countattribute.anyIncludes all of the current node’s ancestors (as
level="multiple"does) as well as all elements in theprecedingaxis.
In all of these cases, if the
fromattribute is used, the only ancestors that are examined are descendants of the nearest ancestor that matches thefromattribute. In other words, withfrom="h1", the only nodes considered for counting are those that appear under the nearest<h1>attribute.fromThe
fromattribute is an XPath pattern that defines where counting ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access