Bonjour,
comme je débute en xml si quelqu'un pouvait m'aider un petit peu:
J'ai un fichier xml de ce type
Code :
- <?xml version="1.0" encoding="ISO-8859-1" ?>
- - <products>
- - <product>
- <name>ddd</name>
- <productUrl>http://xxxx</productUrl>
- <imageUrl>http://www.xxxx(fichier image)</imageUrl>
- <description>decrire le type</description>
- <price>1.00</price>
- <currency>EUR</currency>
- <TDProductId>n° de produit</TDProductId>
- <TDCategoryID>522</TDCategoryID>
- <TDCategoryName>famille</TDCategoryName>
- <merchantCategoryName>peu importe</merchantCategoryName>
- <programName>prog</programName>
- <programLogoPath>logopart</programLogoPath>
- <programId>n°</programId>
- - <fields>
- <cast>avec : tel ou tel</cast>
- <country>USA</country>
- </fields>
- </product>
- ?>
|
Ensuite j'ai créé un xsl:
Code :
- <?xml version="1.0" encoding="iso-8859-1"?><!-- DWXMLSource="famille.xml" -->
- <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 XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
- <xsl:template match="/">
-
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
- <title>Untitled Document</title>
- </head>
- <body>
- <table width="100%">
- <xsl:for-each select="products/product">
- <tr>
- <td rowspan="2"><img>
- <xsl:attribute name="src">
- <xsl:value-of select="imageUrl" />
- </xsl:attribute>
- </img> </td>
- <td colspan="2"><xsl:value-of select="name"/></td>
- </tr>
- <tr>
- <td colspan="2"><xsl:value-of select="description"/></td>
- </tr>
- <tr>
- <td><img>
- <xsl:attribute name="src">
- <xsl:value-of select="programLogoPath" />
- </xsl:attribute>
- </img></td>
- <td><xsl:value-of select="price"/>€</td>
- <td><a href="{productUrl}" target="_blank">Achetez maintenat</a></td>
- </tr>
- </xsl:for-each>
- </table>
- </body>
- </html>
- </xsl:template>
- </xsl:stylesheet>
|
ce qui donne:http://www.netoupasnet.net/fluxxmldvd/famille.xml
mais maintenat je voudrais mettre cela au couleur de mon site donc j'ai mis ce code dans un page php
Code :
- <?php
- $xml = domxml_open_file('famille.xml');
- $xsl = domxml_xslt_stylesheet_file('demo.xsl');
- $html = $xsl->process($xml);
- echo $html->dump_mem();
- ?>
|
mais cela ne fonctionne pas(http://www.netoupasnet.net/fluxxmldvd/famille.php)
(mon hébergeur utilise php5)