J'utilise une feuille de style XSL pour transformer un document XML en HTML dans un environnement android.XSL utilisant le paramètre pour chaque
<?xml version="1.0" encoding="UTF-8"?>
<list>
<project id="Proj02">
<observation id="Proj02_Obs001">
…
</observation>
</project>
<project id="Proj01">
<observation id="Proj01_Obs002">
…
</observation>
<observation id="Proj01_Obs001">
…
</observation>
</project>
</list>
Pour mon fichier html, je veux parcourir toutes les observations d'un projet spécifique. Pour ce faire, je passe un paramètre pour le projet @ id:
transformer.setParameter("projID", "Proj01")
Utilisation du fichier xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<xsl:param name="projID" />
<html>
<body>
<table>
<tr>
<th style="text-align:left">ID</th>
…
</tr>
<xsl:for-each select="list/project[@id=$projID]/observation">
<tr>
<td>
<xsl:value-of select="@id" />
</td>
…
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Je reçois aucun résultat.
Comment dois-je modifier cette ligne?
<xsl:for-each select="list/project[@id=$projID]/observation">
Merci pour votre aide!
Wow, super! Merci pour cette réponse très rapide. Travaille pour moi! – Nico