Voilà, je n'arrive pas à faire fonctionner ce fichu XSLT ( Sablotron ) ( exemples chopés dans le Linux Magazine n°51 )
J'ai un fichier XML en entrée :
CODE |
<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.1/EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <body> <h1>Accueil</h1> <p> Ceci est la super page de <b>monprog</b> </p> </body> |
J'ai un fichier xsl en traitement :
CODE |
<?xml version="1.0" encoding="iso-8859-1" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C/DTD HTML 4.0 Transitional/EN" doctype-system="http://www.w3.org/TR/REC-html40/loose.dtd" indent="yes" /> <xsl:template match="/body"> <html> <xsl:comment> This web site is (c) 2003 Me Feel free to get inspiration from this site, as soon as you leave this comment here THIS PAGE WAS AUTOMATICALLY GENERATED FROM TEMPLATES. DO NOT MODIFY ANYTHING IN THIS FILE: IT WILL BE OVERWRITTEN AND ANY CHANGE WILL BE LOST </xsl:comment> <head> <link rel="stylesheet" type="text/css" href="monprog.css" /> <title><xsl:apply-templates select="/body/h1[position()=1]/*"/></title> </head> <body> <xsl:apply-templates select="@*/node()"/> </body> </html> </xsl:template> <xsl:template match="@*/node()"> <xsl:copy> <xsl:apply-templates select="@*/node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> |
et mon fichier PHP qui devrait m'afficher le résultat ...
CODE |
<?php chdir("C:/program files/easyphp/www/test/xml/"); $xmldata='file://home1.xml'; $xsl='file://main1.xsl'; xslt_create(); xslt_process($xsl, $xmldata, $html); print $html; ?> |
Je fais appel à vous pour me filer un petit coup de main ... histoire que je voit ce qui cloche.
Merci !