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
|
<xsl:template match="/">
<html>
<head>
<meta charset="utf-8"/>
<title> La bibliothèque chérie des L3 </title>
</head>
<body>
<h1>Liste des livres</h1>
<table border="1" width="100%">
<tr bgcolor="#9acd32">
<th>Code</th>
<th>Auteur</th>
<th>Description</th>
<th>Prix</th>
</tr>
<xsl:for-each select="bibliotheque/livre">
<tr>
<td><xsl:value-of select="@code"/></td>
<td><xsl:element name="img">
<xsl:attribute name="src"><xsl:value-of select="photo/@source"/></xsl:attribute>
<xsl:attribute name="alt"><xsl:text>"</xsl:text><xsl:value-of select="photo/@source"/></xsl:attribute>
</xsl:element></td>
<td>
<xsl:value-of select="titre"/> :
<xsl:value-of select="description"/> par
<xsl:value-of select="auteur"/>
<xsl:if test="titre[@lang='Fr']">(en francais)</xsl:if>
<xsl:if test="titre[@lang='En']">(en Englais)</xsl:if>
</td>
<td>
<xsl:value-of select="prix"/> XPF
</td>
</tr>
</xsl:for-each>
</table>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match = "livre">
<h2>Valeur totale des livres de la bibliothèque</h2>
<h3><xsl:value-of select="sum(//livre/prix[@devise='XPF'])"/> XPF</h3>
<h3><xsl:value-of select="sum(//livre/prix[@devise='Euros'])"/> Euros</h3>
<h2>Le livre le plus cher coûte</h2>
<h3><xsl:for-each select="//livre">
<xsl:sort select="prix[@devise='XPF']" order="descending"/>
<xsl:if test="position()=1">
<xsl:value-of select="prix[@devise='XPF']"/> XPF
</xsl:if>
</xsl:for-each></h3>
<h2>Le livre le moins cher coûte</h2>
<h3><xsl:for-each select="//livre">
<xsl:sort select="prix[@devise='XPF']"/>
<xsl:if test="position()=1">
<xsl:value-of select="prix[@devise='XPF']"/> XPF
</xsl:if>
</xsl:for-each></h3>
</xsl:template> |