File: Data.xml
<?xml version="1.0"?>
<book>
<title>XSLT Topics</title>
<chapter>
<title>XPath</title>
</chapter>
<chapter>
<title>Stylesheet Basics</title>
</chapter>
<chapter>
<title>Branching and Control Elements</title>
</chapter>
</book>
File: Transform.xslt
<?xml version="1.0"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="book">
<html>
<head>
<title>Thai numbering</title>
</head>
<body style="font-family: sans-serif;">
<h1>Thai numbering</h1>
<p style="font-size: 150%">
<xsl:for-each select=".//sect2">
<xsl:number level="any" count="sect2"
format="๑ "/>
<xsl:value-of select="title"/>
<br/>
</xsl:for-each>
</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Output:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Thai numbering</title>
</head>
<body style="font-family: sans-serif;">
<h1>Thai numbering</h1>
<p style="font-size: 150%"></p>
</body>
</html>
|