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
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" version="html4.01" encoding="ISO-8859-1" doctype-public="-//W3C//DTD HTML 4.01//EN"/>
<xsl:template match="/">
<html>
<head>
<title>Collection de nuages</title>
<script type="text/javascript">
var XMLsource = new Object;
var XSLsource = new Object;
XMLsource = document.XMLDocument;
XSLsource = document.XSLDocument;
function changeordre(){
XSLsort=XSLsource.documentElement.selectNodes("//xsl:sort");
ordre_de_classement=XSLsort[0].getAttribute('order');
if (ordre_de_classement=='ascending')
{(XSLsource.selectNodes("//xsl:sort"))[0].setAttribute('order', 'descending');}
if (ordre_de_classement=='descending')
{(XSLsource.selectNodes("//xsl:sort"))[0].setAttribute('order', 'ascending');}
document.body.innerHTML = XMLsource.transformNode(XSLsource);
}
</script>
</head>
<body onClick="changeordre()">
<h1>Les nuages</h1>
<xsl:for-each select="nuages/nuage">
<h2><xsl:value-of select="nom/text()"/></h2>
<p>Ce type de nuage possède les espèces suivantes :</p>
<ul>
<xsl:for-each select="nom/espece"><xsl:sort select="." order="ascending"/><li><xsl:value-of select="."/></li></xsl:for-each>
</ul>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet> |