débutant xml

débutant xml - XML/XSL - Programmation

Marsh Posté le 11-08-2008 à 13:48:02    

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 :
  1. <?xml version="1.0" encoding="ISO-8859-1" ?>
  2.   - <products>
  3.   - <product>
  4.     <name>ddd</name>
  5.     <productUrl>http://xxxx</productUrl>
  6.     <imageUrl>http://www.xxxx(fichier image)</imageUrl>
  7.     <description>decrire le type</description>
  8.     <price>1.00</price>
  9.     <currency>EUR</currency>
  10.     <TDProductId>n° de produit</TDProductId>
  11.     <TDCategoryID>522</TDCategoryID>
  12.     <TDCategoryName>famille</TDCategoryName>
  13.     <merchantCategoryName>peu importe</merchantCategoryName>
  14.    <programName>prog</programName>
  15.     <programLogoPath>logopart</programLogoPath>
  16.     <programId>n°</programId>
  17.   - <fields>
  18.     <cast>avec : tel ou tel</cast>
  19.     <country>USA</country>
  20.    </fields>
  21.     </product>
  22. ?>


 
Ensuite j'ai créé un xsl:

Code :
  1. <?xml version="1.0" encoding="iso-8859-1"?><!-- DWXMLSource="famille.xml" -->
  2.   <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3.   <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"/>
  4.   <xsl:template match="/">
  5.  
  6.   <html xmlns="http://www.w3.org/1999/xhtml">
  7.   <head>
  8.   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
  9.   <title>Untitled Document</title>
  10.   </head>
  11.   <body>
  12.   <table width="100%">
  13.   <xsl:for-each select="products/product">
  14.     <tr>
  15.       <td rowspan="2"><img>
  16.   <xsl:attribute name="src">
  17.   <xsl:value-of select="imageUrl" />
  18.   </xsl:attribute>
  19.   </img> </td>
  20.       <td colspan="2"><xsl:value-of select="name"/></td>
  21.     </tr>
  22.     <tr>
  23.       <td colspan="2"><xsl:value-of select="description"/></td>
  24.     </tr>
  25.     <tr>
  26.       <td><img>
  27.   <xsl:attribute name="src">
  28.   <xsl:value-of select="programLogoPath" />
  29.   </xsl:attribute>
  30.   </img></td>
  31.       <td><xsl:value-of select="price"/>€</td>
  32.       <td><a href="{productUrl}" target="_blank">Achetez maintenat</a></td>
  33.     </tr>
  34.     </xsl:for-each>
  35.   </table>
  36.   </body>
  37.   </html>
  38.   </xsl:template>
  39.   </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 :
  1. <?php
  2.   $xml = domxml_open_file('famille.xml');
  3.   $xsl = domxml_xslt_stylesheet_file('demo.xsl');
  4.   $html = $xsl->process($xml);
  5.   echo $html->dump_mem();
  6.   ?>


mais cela ne fonctionne pas(http://www.netoupasnet.net/fluxxmldvd/famille.php)
(mon hébergeur utilise php5)

Reply

Marsh Posté le 11-08-2008 à 13:48:02   

Reply

Marsh Posté le 11-08-2008 à 13:54:22    

franzy51 a écrit :


mais cela ne fonctionne pas(http://www.netoupasnet.net/fluxxmldvd/famille.php)
(mon hébergeur utilise php5)


Tout est dit : Call to undefined function domxml_open_file()
 
Vérifie via un phpinfo() que ton hébergeur ait activé les libs domxml


---------------
Feedback : http://forum.hardware.fr/hfr/Achat [...] 2666_1.htm
Reply

Marsh Posté le 11-08-2008 à 16:52:35    

Bonjour,
d'abord merci pour la réponse, on dira qu'il est activé (enfin pas sur)
http://php5.web4all.fr/#module_gd
Mais sinon comment faire pour afficher le résultat sur mon site?

Reply

Marsh Posté le 11-08-2008 à 17:15:07    

franzy51 a écrit :

Bonjour,
d'abord merci pour la réponse, on dira qu'il est activé (enfin pas sur)
http://php5.web4all.fr/#module_gd


Si tu es hébergé chez Web4All : http://forums.web4all.fr/index.php [...] f=32&t=517 (tout en bas)
Si tu es chez OVH (comme le Whois l'indique) : http://forum.ovh.net/showthread.php?t=10515


---------------
Feedback : http://forum.hardware.fr/hfr/Achat [...] 2666_1.htm
Reply

Marsh Posté le 11-08-2008 à 17:27:14    

C'est bizarre cette fonction n'existe pas dans mon panel d'administration, j'ai mis un htacess mais la non plus cela ne fonctionne pas, je vais essayer de les contacter pour avoir plus de renseignement

Reply

Marsh Posté le 11-08-2008 à 17:45:13    

franzy51 a écrit :

C'est bizarre cette fonction n'existe pas dans mon panel d'administration, j'ai mis un htacess mais la non plus cela ne fonctionne pas, je vais essayer de les contacter pour avoir plus de renseignement


Tu es chez qui ?
Le plus simple est de placer un script avec uniquement <?php phpinfo(); ?> quelque part sur ton site est de regarder le résultat...


---------------
Feedback : http://forum.hardware.fr/hfr/Achat [...] 2666_1.htm
Reply

Marsh Posté le 11-08-2008 à 17:50:34    

je suis chez web4all
le fichier phpinfo
http://www.netoupasnet.net/fluxxmldvd/info.php

Reply

Marsh Posté le 11-08-2008 à 17:59:12    

Et si tu mets l'extension php5 à ton fichier : famille.php5 ?


---------------
Feedback : http://forum.hardware.fr/hfr/Achat [...] 2666_1.htm
Reply

Marsh Posté le 11-08-2008 à 18:06:29    

si je met php5
voici le résultat
http://www.netoupasnet.net/fluxxmldvd/famille.php5

Reply

Marsh Posté le 11-08-2008 à 18:08:59    

pas bô  :D


---------------
Feedback : http://forum.hardware.fr/hfr/Achat [...] 2666_1.htm
Reply

Marsh Posté le 11-08-2008 à 18:08:59   

Reply

Marsh Posté le 11-08-2008 à 18:16:23    

pas terrible en effet :lol:

Reply

Marsh Posté le 11-08-2008 à 20:36:56    

j'ai même essayé ce code est rien ne s'affiche
http://www.netoupasnet.net/fluxxmldvd/test.html

Code :
  1. <html>
  2. <body>
  3. <script type="text/javascript">
  4. // chargement du fichier XML
  5. var xml = new ActiveXObject("Microsoft.XMLDOM" )
  6. xml.async = false
  7. xml.load("../fluxxmldvd/famille.xml" )
  8. // chargement du fichier XSL
  9. var xsl = new ActiveXObject("Microsoft.XMLDOM" )
  10. xsl.async = false
  11. xsl.load("../fluxxmldvd/demo.xsl" )
  12. // transformation en Html
  13. document.write(xml.transformNode(xsl))
  14. </script>
  15. </body>
  16. </html>


Si quelqu'un pouvait trouver l'erreur

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed