Hello,
I have to convert a XML with a XSL file in a html file. But it doesn't work.
My webfolder is like this :
C:\Program Files\EasyPHP1-7\www\
- stylesheet.xsl
- Test.xml
- Test.DTD
- administration.php
stylesheet.xsl
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="LISTE_RAPPORT/SUJET">
<HTML>
<HEAD>
<TITLE>
<b>LISTE DES SUJETS DE TAVAIL PERSONNEL</b>
</TITLE>
</HEAD>
<BODY BGCOLOR="#EAEAAE">
<center>
<b>LISTE DES SUJETS DE TAVAIL PERSONNEL</b>
</center>
<br/>
<br/>
<xsl:value-of select="."/>
<!--
<table border='1' cellpadding ='6' CELLSPACING='0' bordercolor='#000000'>
<tr>
<td><b>Numéro</b></td>
<td><b>Titre</b></td>
<td><b>Professeur Responsable</b></td>
<td><b>Etudiant</b></td>
<td><b>Fichier PDF</b></td>
<td><b>Fichier PPT</b></td>
<td><b>Date de Présentation</b></td>
</tr>
<xsl:for-each select="LISTE_RAPPORT/SUJET">
<tr>
<td><xsl:value-of select="@NUMERO"/></td>
<td><xsl:value-of select="TITRE"/></td>
<td><xsl:value-of select="PROF_RESP"/></td>
<td><xsl:value-of select="ETUDIANT"/></td>
<td><xsl:value-of select="FICHIER_RAPPORT"/></td>
<td><xsl:value-of select="FICHIER_PRESENTATION"/></td>
<td><xsl:value-of select="DATE_PRESENTATION"/></td>
</tr>
</xsl:for-each>
</table>
-->
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
Test.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="C:\Program Files\EasyPHP1-7\www\stylesheet.xsl"?>
<LISTE_RAPPORT>
<SUJET NUMERO="2">
<TITRE>ffdddf</TITRE>
<PROF_RESP>Lassa⤠Gannoune</PROF_RESP>
<ETUDIANT>dfdfd</ETUDIANT>
<FICHIER_RAPPORT><![CDATA[<a href='C:\Program Files\EasyPHP1-7\www\Rapports.aaaaa.pdf'>aaaaa.pdf</a>]]></FICHIER_RAPPORT>
<FICHIER_PRESENTATION><![CDATA[<a href='C:\Program Files\EasyPHP1-7\www\Presentations.aaaaa.ppt'>aaaaa.ppt</a>]]></FICHIER_PRESENTATION>
<DATE_PRESENTATION>VGXC</DATE_PRESENTATION>
</SUJET>
</LISTE_RAPPORT>
administration.php
$xp = xslt_create();
xslt_set_encoding($xp, 'utf-8');
xslt_set_base($xp, 'C:\\Program Files\\EasyPHP1-7\\www\\');
if (($result = xslt_process($xp, 'Test.xml', 'stylesheet.xsl', NULL, NULL,$xsl_params))) {
// print output
echo $result;
} else {
// display error
$errmsg = 'XSLT error: ' .xslt_error($xp) .' (error code: ' .xslt_errno($xp) .')';
trigger_error($errmsg, E_USER_ERROR);
} // endif
// free the resources occupied by the handler
xslt_free($xp);
The error on the browser
Warning: Sablotron error on line 1: XML parser error 4: not well-formed (invalid token) in d:\programmation\php\proj_sem\administration.php on line 150
Fatal error: XSLT error: XML parser error 4: not well-formed (invalid token) (error code: 2) in d:\programmation\php\proj_sem\administration.php on line 157
My question
WHY ?????????????????
I spend a lot of time on it without any result, can somone help me please ?
Thanks for all the time u spend ;-)