Name
<xsl:number> — Counts something. 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
- count
The
countattribute is an XPath expression that defines what should be counted.- level
This 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:-
single Counts items at one level only. The XSLT processor goes to the first node in the
ancestor-or-selfaxis that matches thecountattribute, then counts that node plus all its preceding siblings that also match thecountattribute.-
multiple Counts items at multiple levels. The XSLT processor looks at all ancestors of the current node and the current node itself, then it selects all of those nodes that match the
countattribute.-
any Includes 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.-
- from
The
fromattribute is an XPath expression that defines where counting starts. For example, you can use thefromattribute to say that counting should begin at the previous<h1> ...