w3schools    w3Schools
Search :
   
HOME HTML CSS XML JAVASCRIPT ASP PHP SQL MORE...   References Examples Forum About
ADVERTISEMENTS

XML Certification
Download XML editor
Custom Programming
 
Table of contents
XSLT Basic
XSLT HOME
XSL Languages
XSLT Introduction
XSLT Browsers
XSLT Transform
XSLT <template>
XSLT <value-of>
XSLT <for-each>
XSLT <sort>
XSLT <if>
XSLT <choose>
XSLT Apply

XSLT Advanced
XSLT on the Client
XSLT on the Server
XSLT Edit XML
XSLT Editors
XSLT Summary

Examples
XSLT Examples

References
XSLT Elements
XSLT Functions

Selected Reading
Web Statistics
Web Glossary
Web Hosting
Web Quality

Browse Tutorials
 

XSLT <xsl:number> Element


XSLT Element Reference Complete XSLT Element Reference

Definition and Usage

The <xsl:number> element is used to determine the integer position of the current node in the source. It is also used to format a number.


Syntax

<xsl:number
count="expression"
level="single|multiple|any"
from="expression"
value="expression"
format="formatstring"
lang="languagecode"
letter-value="alphabetic|traditional"
grouping-separator="character"
grouping-size="number"/>

Attributes

Attribute Value Description
count expression Optional. An XPath expression that specifies what nodes are to be counted
level single
multiple
any
Optional. Controls how the sequence number is assigned

Can be one of the following:

  • single (default)
  • multiple
  • any (not supported by Netscape 6)
from expression Optional. An XPath expression that specifies where the counting will start
value expression Optional. Specifies a user-provided number that is used in place of a sequence generated number
format formatstring Optional. Defines the output format for the number. Can be one of the following:
  • format="1" results in 1 2 3 . .
  • format="01" results in 01 02 03 (not supported by Netscape 6)
  • format="a" results in a b c . . (not supported by Netscape 6)
  • format="A" results in A B C. . (not supported by Netscape 6)
  • format="i" results in i ii iii iv . . (not supported by Netscape 6)
  • format="I" results in I II III IV . . (not supported by Netscape 6)
lang languagecode Optional. Specifies the language alphabet to be used for the numbering (Not supported by Netscape 6)
letter-value alphabetic
traditional
Optional. Specifies whether the numbering in the selected language is alphabetic or traditional. The default is alphabetic
grouping-separator character Optional. Specifies what character should be used to separate groups of digits. The default is the comma
grouping-size number Optional. Specifies how many digits are in the groups that are being separated by the character specified in the grouping-separator attribute. The default is 3

Example 1

<xsl:number value="250000" grouping-separator="."/>

Output:

250.000

Example 2

<xsl:number value="250000" grouping-size="2"/>

Output:

25,00,00

Example 3

<xsl:number value="12" grouping-size="1"
grouping-separator="#" format="I"/>

Output:

X#I#I

Example 4

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <html>
  <body>
  <p>
  <xsl:for-each select="catalog/cd">
    <xsl:number value="position()" format="1" />
    <xsl:value-of select="title" /><br />
  </xsl:for-each>
  </p>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>


XSLT Element Reference Complete XSLT Element Reference



 
WEB HOSTING
Web charting
Cheap VPS Hosting
$10 Domain Name
Registration
Cheap Domain Names
Cheap Web Hosting
Amins Point
PHP MySQL Hosting
Top 10 Web Hosting
UK Reseller Hosting
Live Cricket Score
FREE Web Hosting
WEB BUILDING
Online Travel
Web development
EDUCATION
US Web Design Schools
HTML Certification
JavaScript Certification
XML Certification
PHP Certification
ASP Certification
Home HOME or Top of Page Validate   Validate   W3C-WAI level A conformance icon Printer Friendly  Printer Friendly

W3Schools is for training only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user.
While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright 1999-2009 by Refsnes Data. All Rights Reserved.