Quote:
quote:Originally posted by Martin Honnen
If you want to generate a HTML document with your XSLT stylesheet then you should make sure you have the proper HTML document structure with a html root element containing a head and a body element:
Code:
<xsl:template match="/">
<html lang="en">
<head>
<title>document title</title>
</head>
<body>
<xsl:call-template name="top"/>
<xsl:apply-templates/>
<xsl:call-template name="bottom"/>
</body>
</html>
</xsl:template>
<xsl:template name="top">
<div id="t">This is the top of the page.</div>
</xsl:template>
<xsl:template name="bottom">
<a href="#t">go to top</a>
</xsl:template>
|
Thank you.
But at which places exactly do I integrate this code into my stylesheet?
I want the "back to top" link to point to the title: <title>Outils XML</title>
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"
encoding="utf-8"/>
<xsl:template match="/">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Outils XML</title>
</head>
<body>
<h2>Outils XML</h2>
<table border="1">
<tr>
<th>Nom</th>
<th>Auteurs</th>
<th>Licence</th>
<th>Téléchargement</th>
<th>Commentaire</th>
</tr>
<xsl:for-each select="ListeOutils/outil">
<tr>
<td><xsl:value-of select="nom"/></td>
<td><xsl:value-of select="auteurs"/></td>
<td><xsl:value-of select="licence"/></td>
<td><xsl:value-of select="téléchargement"/></td>
<td><xsl:value-of select="commentaire"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>