Bonjour,
Débutant en xml, je suis a la recherche d'un moyen de lire un fichier xml, qui utilise une feuille de style.
Sous Firefox, lorsque j'appel www.monsite.com/fichier.xml il affiche bien les données traitées en fonction de la feuille de style.
J'aimerais obtenir la même chose, mais dans un div, d'où le parseur.
voici un extrait du xml (pour des raisons de confidentialités, les données ont été remplacées) :
Code XML :
<markers>
<marker name="" lat="" lng="" logo="" url="" details="">
<nom></nom>
<pays></pays>
<url></url>
<projet>x</projet>
<projet>y</projet>
<projet>z</projet>
</marker>
</markers>
voici le fichier xslt
Code XML :
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html>
<head>
<title>nom</title>
</head>
<body>
<!--<table>-->
<p>Pour les <xsl:value-of select="count(markers/marker/nom)"/> instituts, voici le détail des <xsl:value-of select="count(markers/marker/projet[.= 'x'])"/> qui travaillent sur le projet séléctionné:</p>
<!--<table border="1"><tr><th>Pays</th><th>Nom de l'institut</th><th>pays</th><th>url</th></tr>-->
<xsl:for-each select="markers/marker[not(String)=preceding-sibling::marker/pays]">
<xsl:sort select="pays"/>
<xsl:sort select="nom"/>
<xsl:if test="projet = 'x'">
<td>
<xsl:value-of select="pays"/><i> (<xsl:value-of select="count(nom)"/>)</i>
</td>
<tr>
<td>
<xsl:value-of select="nom"/>
</td>
<!--<td>
<xsl:value-of select="url"/>
</td>-->
</tr>
</xsl:if>
</xsl:for-each>
<!--</table>-->
</body>
</html>
</xsl:template>
</xsl:stylesheet>
La contrainte est le langage, PHP 4.3
math11