File: Data.xml
<?xml version="1.0"?>
<list xml:lang="en">
<title>title 1</title>
<listitem>item 1</listitem>
<listitem>item 2</listitem>
<listitem>item 3</listitem>
<listitem xml:lang="sw">item 4</listitem>
<listitem xml:lang="en-gb">item 5</listitem>
<listitem xml:lang="zu">item 6</listitem>
<listitem xml:lang="jz">item 7</listitem>
</list>
File: Transform.xslt
<?xml version="1.0"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output
method="xhtml"
encoding="ISO-8859-3"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
<xsl:template match="/">
<html>
<head>
<title><xsl:value-of select="/list/title"/></title>
</head>
<body>
<h1><xsl:value-of select="/list/title"/></h1>
<p>
<xsl:for-each select="/list/listitem">
<xsl:number format="1. "/>
<xsl:value-of select="."/>
<br/>
</xsl:for-each>
</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Output:
<?xml version="1.0" encoding="ISO-8859-3"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>title 1</title>
</head>
<body>
<h1>title 1</h1>
<p>1. item 1
<br></br>2. item 2
<br></br>3. item 3
<br></br>4. item 4
<br></br>5. item 5
<br></br>6. item 6
<br></br>7. item 7
<br></br>
</p>
</body>
</html>
|