How can I internationalize XSLT auto-numbering?
Created Oct 30, 2001
For example, if we had an XSL document for a book broken down into chapters called Crawling, Walking, and Running, the XSL transformation snippet might look like this:
<xsl:template match="book">
<xsl:number/>
<xsl:text> </xsl:text>
<xsl:value-of select="chapter" />
</xsl:template>
The output would be:
1 Crawling
2 Walking
3 Running
For I18N, we change the element to begin with the desired value. To use Thai digits, the element would be:
<xsl:number format="๑"/>
To use the Greek letters alpha, beta, gamma and so on:
<xsl:number format="α" letter-value="traditional"/>
Clearly the appropriate fonts or character sets must be available. For more information, see XSL Transformations (XSLT) - 7.7 Numbering; for some ( non-I18N'ed ) examples, see XSL Basics (part 2).