<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns
sl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:param name="field"/>
<xsl:param name="order"/>
<xsl:template match="agence">
<table>
<xsl:variable name="neworder">
<xsl:if test="$order='ascending'">descending</xsl:if>
<xsl:if test="$order='descending'">ascending</xsl:if>
</xsl:variable>
<tr>
<th><a href="javascript
:tri('destination','{$neworder}')">Destination</a></th>
<th><a href="javascript
:tri('prix','{$neworder}')">Prix</a></th>
<th><a href="javascript
:tri('type','{$neworder}')">Type</a></th>
<th><a href="javascript
:tri('niveau','{$neworder}')">Niveau</a></th>
</tr>
<xsl:for-each select="voyage">
<xsl:sort select="*[name()=$field]" order="{$order}"/>
<tr>
<td><xsl:value-of select="destination"/></td>
<td><xsl:value-of select="prix"/></td>
<td><xsl:value-of select="type"/></td>
<td><xsl:value-of select="niveau"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
Partager