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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<head>
<title>Listing VO</title>
<script language="JScript"><![CDATA[
// Déclaration des variables
var XSLSource = new Object();
var XMLSource = new Object();
// Chargement des documents XML et XSL
XMLSource = document.XMLDocument;
XSLSource = document.XSLDocument;
function tri (rubrique) {
// Déclaration des variables
var XSLSort = new Object();
// Sélection de l'ordre xsl:sort
XSLSort =
XSLSource.documentElement.selectNodes("//xsl:sort");
// Affectation de la rubrique de tri
if (XSLSort[0].attributes(0).text == rubrique.toString()){
if ( XSLSort[0].attributes(1).text == "ascending") {
XSLSort[0].attributes(1).text = "descending";
} else {
XSLSort[0].attributes(1).text = "ascending";
}
} else {
XSLSort[0].attributes(1).text = "ascending";
}
XSLSort[0].attributes(0).text = rubrique.toString();
// affichage de l'ordre de tri
XSLem = XSLSource.documentElement.selectNodes("//p/em");
XSLem [0].text = rubrique.toString();
XSLem [1].text = XSLSort[0].attributes(1).text ;
// Réaffichage de la page
document.body.innerHTML =
XMLSource.transformNode(XSLSource);
}]]></script>
</head>
<body>
<p>Tri sur <em>auteur</em> par ordre <em>descending</em>.</p>
<p>Cliquez sur un titre pour changer l'ordre de tri.</p>
<table border="1" cellspacing="0" cellpadding="3">
<tr bgcolor="#FFFF00">
<th id="HeaderColumnauteur"
onclick="javascript:tri('auteur');">auteur</th>
<th id="HeaderColumntitre"
onclick="javascript:tri('titre');">titre</th>
<th id="HeaderColumnannee_parution"
onclick="javascript:tri('annee_parution');">annee_parution</th>
<th id="HeaderColumnediteur"
onclick="javascript:tri('editeur');"
>editeur</th>
<th id="HeaderColumncategorie"
onclick="javascript:tri('categorie');"
>categorie</th>
<th id="HeaderColumncode_barre"
onclick="javascript:tri('code_barre');"
>code_barre</th>
</tr>
<xsl:apply-templates select="cdtheque/cdaudio">
<xsl:sort select="auteur" order="descending"/>
</xsl:apply-templates>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="cdaudio">
<tr>
<td>
<xsl:value-of select="auteur"/>
</td>
<td>
<xsl:value-of select="titre"/>
</td>
<td>
<xsl:value-of select="annee_parution"/>
</td>
<td>
<xsl:value-of select="editeur"/>
</td>
<td>
<xsl:value-of select="categorie"/>
</td>
<td>
<xsl:value-of select="code_barre"/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet> |