1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
extension-element-prefixes="redirect">
<xsl:template match="students">
<html>
<h1>liste des eleves:</h1>
<ul>
<xsl:apply-templates select="//name" />
</ul>
<xsl:apply-templates select="//student" />
</html>
</xsl:template>
<xsl:template match="name">
<li>
<xsl:element name="a">
<xsl:attribute name="href"><xsl:value-of select="concat(../../@id,'.html')" /></xsl:attribute>
<xsl:value-of select="." />
</xsl:element>
</li>
</xsl:template>
<xsl:template match="student">
<xsl:variable name="file"><xsl:value-of select="concat(@id,'.html')"/></xsl:variable>
<redirect:write file="{$file}">
<html>
<h1>nom: <xsl:value-of select=".//name" /></h1><br/>
prenom: <xsl:value-of select=".//forname" /><br/>
<xsl:variable name="id"><xsl:value-of select=".//sex"/></xsl:variable>
sexe: <xsl:value-of select="//base/sexs/sex[@id=$id]"/><br/>
</html>
</redirect:write>
</xsl:template>
</xsl:stylesheet> |
Partager