Listato 7 - Codice del foglio di stile "xstyle.xsl"

<?xml version="1.0">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<xsl:output method="html" indent="yes"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" />

<xsl:template match="/">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>X-blog</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" title="main" href="mainstyle.css" type="text/css" />
</head>

<body>
<div id="sezprinc">
<div id="testata">
<img src="xblog.gif" width="165" height="65" alt="logo xblog" />
</div>
<div id="menu">
<p><a href="#">home page</a> - <a href="#">about</a> - <a href="#">archivi</a>
- <a href="#">contatti</a> -------------------- <a href="#">e-m@il me</a></p>
</div>
<div id="contenuto">
<div id="navigazione">
<h1>sezione 1</h1>
<p><a href="#">link 1</a></p>
<p><a href="#">link 2</a></p>
<p><a href="#">link 3</a></p>
<h1>sezione 2</h1>
<p><a href="#">link 1</a></p>
<p><a href="#">link 2</a></p>
<p><a href="#">link 3</a></p>
</div>

<div id="post">
<xsl:for-each select="news/post">
<xsl:sort data-type="text" select="data" order="descending"/>
<h1><xsl:value-of select="titolo" /></h1>
<h2><xsl:value-of select="data"/></h2>
<p><xsl:apply-templates select="testo"/></p>
</xsl:for-each>
</div>
</div>
</div>
</body>

</html>

</xsl:template>
<xsl:template match="link">
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="@href"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>

</xsl:stylesheet>