xsl:number

Inserts a formatted number into the result tree.

Format

<xsl:number  
  [level = "single" | "multiple" | "any"] 
  [count = pattern] 
  [from = pattern] 
  [value = number-expression] 
  [format = {string}] 
  [lang = {nmtoken}] 
  [letter-value = {"alphabetic" | "traditional"}] 
  [grouping-separator = {char}] 
  [grouping-size = {number}]/>  

Description

You can use the value attribute to specify an expression for the number to be inserted. The XSLT processor evaluates the expression. The resulting object is converted to a number as if by a call to the number() function. The processor rounds the number to an integer and then uses the specified attributes to convert it to a string. The value of each attribute is interpreted as an attribute value template. After conversion, the resulting string is inserted in the result tree.

The following attributes control how the current node is to be numbered:

Example

The following example numbers a sorted list:

<xsl:template match="items"> 
  <xsl:for-each select="item"> 
    <xsl:sort select="."/> 
<p> 
  <xsl:number value="position()" format="1. "/> 
  <xsl:value-of select="."/> 
</p> 
  </xsl:for-each> 
</xsl:template> 

Introduction to the XQuery Mapper

This free online video demonstration covers Stylus Studio's synchronized XQuery editing and mapping tool which allows you to create any XQuery expression, either manually using Stylus Studio's XQuery editor.

Java Web Services

Stylus Studio's Web Service Call Composer simplifies Java Web Service development by making it easy to find, invoke, and test any Java Web Service deployed on any popular Java Web Service framework, such as Apache AXIS.

Java IDE

Edit, compile and debug and generate Java code with Stylus Studio's Java Integrated Development Environment (IDE). Supports popular Java XML processing components including Apache Xalan, Apache Axis, Apache Xerces, Saxon and more.

The XML Primer: Editing and Validating XML in Stylus Studio

The XML primer demonstrates editing and validating XML in Stylus Studio demonstrates XML editing tools and utilities to simplify working with XML documents. Learn how to automate XML editing operations and troubleshoot XML documents today!

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member