Bonjour,
je rencontre un problème bizarre lors d'un essai de transformation via php d'un xml en xsl.
Tout d'abord, voici mes trois fichiers:
Code :
- <?php
- require 'class.php'; // classe sablotron
- # Création de l'objet XS
- $XS = new xslt('ex1.xml','ex2.xsl',true,'sablotron');
- # Transformation
- $XS->transform();
- # Affichage du résultat
- echo $XS->output();
- ?>
|
le fichier "ex2.xsl"
Code :
- <?xml version="1.0"?>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
- <xsl:template match="/">
- <html>
- <body>
- <table border="1" cellspacing="0" cellpadding="3">
- <tr bgcolor="#FFFF00">
- <td>Artiste</td>
- <td>Titre</td>
- </tr>
- <xsl:for-each select="compilation/mp3">
- <xsl:choose>
- <xsl:when test=".[artiste='Alain Souchon']">
- <tr bgcolor="#00FF00">
- <td><xsl:value-of
- select="titre"/></td>
- <td><xsl:value-of
- select="artiste"/></td>
- </tr>
- </xsl:when>
- <xsl:otherwise>
- <tr>
- <td><xsl:value-of select="titre"/></td>
- <td><xsl:value-of
- select="artiste"/></td>
- </tr>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </table>
- </body>
- </html>
- </xsl:template>
- </xsl:stylesheet>
|
le fichier "ex1.xml"
Code :
- <?xml version="1.0"?>
- <compilation>
- <mp3>
- <titre>Foule sentimentale</titre>
- <artiste>Alain Souchon</artiste>
- </mp3>
- <mp3>
- <titre>Solaar pleure</titre>
- <artiste>MC Solaar</artiste>
- </mp3>
- <mp3>
- <titre>Le baiser</titre>
- <artiste>Alain Souchon</artiste> </mp3>
- <mp3>
- <titre>Pourtant</titre>
- <artiste>Vanessa Paradis</artiste>
- </mp3>
- <mp3>
- <titre>Chambre avec vue</titre>
- <artiste>Henri Salvador</artiste>
- </mp3>
- </compilation>
|
Quand je teste la page en local, il affiche cette erreur:
Code :
- Error 3, Level 0
- msgtype : error
- code : 4
- module : Sablotron
- URI : arg:/_xsl
- line : 22
- msg : cannot open file 'C:/APACHE/Apache2/ex1.xml'
|
J'utilise php 4.3.10.10, j'ai activé l'extention php_xslt et php_domxml, et j'ai copié les dll expat, inconv et sablot là où il le faut.
Avez-vous une idée du problème que je rencontre, et de sa
solution .
Merci beaucoup,
Message édité par kebab4 le 29-04-2005 à 14:21:08