Bonjour,
je débute dans le xslt et je rencontre 2 soucis.
Voici le premier: j'essaye de faire une transformation via php pour faire un
tri.
voici mon fichier xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
<cd>
<title>Hide your heart</title>
<artist>Bonnie Tyler</artist>
<country>UK</country>
<company>CBS Records</company>
<price>9.90</price>
<year>1988</year>
</cd>
<cd>
<title>Greatest Hits</title>
<artist>Dolly Parton</artist>
<country>USA</country>
<company>RCA</company>
<price>9.90</price>
<year>1982</year>
</cd>
</catalog>
Mon fichier xsl:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="tri.1"/>
<xsl:param name="tri.2"/>
<xsl:template match="/">
<html>
<body>
<xsl:value-of select="$tri.1"/>
<br/>
<xsl:value-of select="$tri.2"/>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Artist</th>
<th>Title</th>
</tr>
<xsl:for-each select="catalog/cd">
<xsl:sort select="$tri.1"/>
<tr>
<td><xsl:value-of select="artist"/></td>
<td><xsl:value-of select="title"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Le passage de paramètre par php se passe bien puisque j'obtiens bien les
bonnes valeurs avant mon tableau.
Par contre, le tri ne se fait pas.
Lorsque je mets le tri "en dur" (<xsl:sort select="title"/> par exemple),
cela fonctionne.
J'ai essayé <xsl:sort select="value-of select='$tri.1'"/> mais sablotron n'a
pas aimé du tout.
Il doit y avoir une syntaxe mais j'avoue rester coincé.
Quelqu'un aurait-il une idée ?
Merci d'avance.
_________________________________________________________________
MSN Messenger : personnalisez votre messagerie instantanée !
http://g.msn.fr/FR1001/866
--
Devenez redacteur <XML>fr et contribuez au developpement du
xml francophone (http://xmlfr.org/infos/redacteurs/) !
Liste de diffusion "xml-tech@xmlfr.org" (http://xmlfr.org).
Cette liste est a votre disposition pour discuter en francais de
tout sujet technique lie a XML.
Pour resilier votre abonnement, envoyez un message contenant
la commande "unsubscribe" a xml-tech-request@xmlfr.org
(mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
Received on Wed Jun 1 12:29:00 2005