| |||||
| Dernière réponse | |
|---|---|
| Sujet : XML ET XSL, | |
| swich | merci bien
je fais un copy paste du tiens, ca marche nickel... bizzare fo ke je matte ou l'erreur est :heink: |
| Aperçu |
|---|
| Vue Rapide de la discussion |
|---|
| swich | merci bien
je fais un copy paste du tiens, ca marche nickel... bizzare fo ke je matte ou l'erreur est :heink: |
| chocoboy | Tu délires ? Chez moi ca marche :
essai.xml : <?xml version="1.0" encoding="ISO-8859-1"?> <!-- pour identifier le jeu de caracteres et la version de XML --> <?xml-stylesheet href="essai.xsl" type="text/xsl"?> <!DOCTYPE CARNET [ <!ELEMENT CONTACT (Nom,Prenom,Age,Adresse,Mail?)> <!ELEMENT Nom (#PCDATA)> <!ELEMENT Prenom (#PCDATA)> <!ELEMENT Age (#PCDATA)> <!ELEMENT Adresse (#PCDATA)> <!ELEMENT Mail (#PCDATA)> ]> <CARNET> <CONTACT> <Nom>TOTO</Nom> <Prenom> XX </Prenom> <Age> 21</Age> <Adresse> 2 trekj </Adresse> <Mail>TOTO@truc.fr</Mail> </CONTACT> <CONTACT> <Nom>iri</Nom> <Prenom> R </Prenom> <Age> 10</Age> <Adresse> 2 ??? </Adresse> <Mail></Mail> </CONTACT> <CONTACT> <Nom>ifi</Nom> <Prenom> F </Prenom> <Age> 10</Age> <Adresse> 2 trekj </Adresse> <Mail>TOTO@truc.fr</Mail> </CONTACT> </CARNET> essai.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="/"> <html> <body> <h2>CARNET D'adresse</h2> <table border="1"> <tr bgcolor="#9acd32"> <th align="left">Nom</th> <th align="left">Prenom</th> <th align="left">Age</th> <th align="left">Email</th> </tr> <xsl:for-each select="CARNET/CONTACT"> <tr> <td><xsl:value-of select="Nom"/></td> <td><xsl:value-of select="Prenom"/></td> <td><xsl:value-of select="Age"/></td> <td><xsl:value-of select="Mail"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> et zou saxon essai.xml essai.xsl >essai.html |
| swich | exact....
:jap: mais bon ca change rien :( |
| chocoboy |
|
| swich | ben ca fonctionne ca.. |
| chocoboy | Déjà dans le XML :
<?xml version="1.0" encoding="ISO-8859-1"?> Et tu voudrais pas que je le fasse à ta place non plus ? :heink: |
| chocoboy |
|
| swich | ben j'aprend le xml pour mon stage....-> ,dc pas d'achat..
sinon elle vient d'ou l'erreur ?? |
| chocoboy | c'est ce bouquin :
http://www.wrox.fr/services/catalo [...] 2744090042 De tout façon, si tu t'intéresse sérieusement à XML/XSLT, le net, c'est bon que pour défricher, après t'es limité (quand tu vois les pavés de 1000 pages sur le sujet)... |
| chocoboy | déjà y a une erreur dans l'encoding du XML et le code est pas très propre |
| chocoboy | Je te conseille de t'acheter le bouquin :
XSL 2nde Edition (Michael Kay) chez Wrox ! ;) |
| swich | cool thx
mais now g une erreur : Fatal error reported by XML parser: Illegal processing instruction target (found "xml" ) URL: file:/C:/Documents and Settings/TEMP/Bureau/essai.xml Line: 2 Column: 2 Error org.xml.sax.SAXParseException: Illegal processing instruction target (found "x ml" ): Illegal processing instruction target (found "xml" ) Transformation failed c vient de koi ?? |
| chocoboy | IE5 n'imlémente qu'une version "Microsoft" de XSL (WD-xsl).
Charges et installes MSXML3 si tu veux voir le résultat dans IE5 (sera inclu dans IE6). Sinon, charges Instant Saxon ou Xalan/xerces pour transformer en HTML à partir d'un XML+XSL... Saxon ici : http://users.iclway.co.uk/mhkay/saxon/instant.html ensuite ouvres une fenetre de commande Dos et tapes : saxon bidule.xml bidule.xsl >bidule.html avec les fichiers bidule.xml et bidule.xsl dans le même rep que saxon) |
| swich | ds mon fichier c bon aussi.. |
| chocoboy | Faut pas le remplacer !
Laisse le comme il est ! <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
| chocoboy |
|
| swich | en fait g ca :
<?xml version="1.0" encoding="ISO8859-1"?> <!-- pour identifier le jeu de caracteres et la version de XML --> <?xml-stylesheet href="essai.xsl" type="text/xsl"?> <!DOCTYPE CARNET [ <!ELEMENT CONTACT (Nom,Prenom,Age,Adresse,Mail?)> <!ELEMENT Nom (#PCDATA)> <!ELEMENT Prenom (#PCDATA)> <!ELEMENT Age (#PCDATA)> <!ELEMENT Adresse (#PCDATA)> <!ELEMENT Mail (#PCDATA)> ]> <CARNET> <CONTACT> <Nom>TOTO</Nom> <Prenom> XX </Prenom> <Age> 21</Age> <Adresse> 2 trekj </Adresse> <Mail>TOTO@truc.fr</Mail> </CONTACT> <CONTACT> <Nom>iri</Nom> <Prenom> R </Prenom> <Age> 10</Age> <Adresse> 2 ??? </Adresse> <Mail></Mail> </CONTACT> <CONTACT> <Nom>ifi</Nom> <Prenom> F </Prenom> <Age> 10</Age> <Adresse> 2 trekj </Adresse> <Mail>TOTO@truc.fr</Mail> </CONTACT> </CARNET> -> essai.xml et : <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="essai.xml"> <xsl:template match="/"> <html> <body> <h2>CARNET D'adresse</h2> <table border="1"> <tr bgcolor="#9acd32"> <th align="left">Nom</th> <th align="left">Prenom</th> <th align="left">Age</th> <th align="left">Email</th> </tr> <xsl:for-each select="CARNET/CONTACT"> <tr> <td><xsl:value-of select="Nom"/></td> <td><xsl:value-of select="Prenom"/></td> <td><xsl:value-of select="Age"/></td> <td><xsl:value-of select="Mail"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> -> essai.xsl les 2 sont ds le meme repertoire... |
| swich | k thx
mais een fait je vienbde m'apercevoir que ca merde pq c ie5 :( |
| darklord | mais je comprends rien à ton problème. Si tu as un serveur web sur ton pc tu peux très bien faire http:// sans avoir de réseau :D
Il est où ton fichier déjà (le fichier qui pointe vers xmlsn ..." Si il est dans le meme répertoire que ton fichier XML tu peux betement mettre le nom du fichier |
| swich | cad ??
c possible ou pas ? |
| darklord | :heink: |
| swich | si je sui en intranet, cette linge la :
xmlns="http://..." je dois la remplacer par quoi?? |




