XML ET XSL,

XML ET XSL, - Programmation

Marsh Posté le 02-07-2002 à 09:48:27    

si je sui en intranet,  cette linge la :
xmlns="http://..." je dois la remplacer par quoi??
 

Reply

Marsh Posté le 02-07-2002 à 09:48:27   

Reply

Marsh Posté le 02-07-2002 à 09:51:10    

:heink:


---------------
Just because you feel good does not make you right
Reply

Marsh Posté le 02-07-2002 à 09:52:02    

cad ??
c possible ou pas ?

Reply

Marsh Posté le 02-07-2002 à 09:53:26    

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
 


---------------
Just because you feel good does not make you right
Reply

Marsh Posté le 02-07-2002 à 09:55:28    

k thx
mais een fait je vienbde m'apercevoir que ca merde pq c ie5 :(

Reply

Marsh Posté le 02-07-2002 à 09:58:22    

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...

Reply

Marsh Posté le 02-07-2002 à 10:21:39    

swich a écrit a écrit :

si je sui en intranet,  cette linge la :
xmlns="http://..." je dois la remplacer par quoi??
 
 




t'as rien compris aux espaces de noms toi, non ?

Reply

Marsh Posté le 02-07-2002 à 10:22:53    

Faut pas le remplacer !
 
Laisse le comme il est !
 
<xsl:stylesheet version="1.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

Reply

Marsh Posté le 02-07-2002 à 10:23:09    

ds mon fichier c bon aussi..

Reply

Marsh Posté le 02-07-2002 à 10:29:53    

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)

Reply

Marsh Posté le 02-07-2002 à 10:29:53   

Reply

Marsh Posté le 02-07-2002 à 10:47:42    

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 ??

Reply

Marsh Posté le 02-07-2002 à 10:58:18    

Je te conseille de t'acheter le bouquin :
 
XSL 2nde Edition (Michael Kay) chez Wrox !  ;)

Reply

Marsh Posté le 02-07-2002 à 10:59:23    

déjà y a une erreur dans l'encoding du XML et le code est pas très propre

Reply

Marsh Posté le 02-07-2002 à 11:01:28    

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)...

Reply

Marsh Posté le 02-07-2002 à 11:02:09    

ben j'aprend le xml pour mon stage....-> ,dc pas d'achat..
sinon  elle vient d'ou l'erreur ??

Reply

Marsh Posté le 02-07-2002 à 11:04:37    

swich a écrit a écrit :

ben j'aprend le xml pour mon stage....-> ,dc pas d'achat..
sinon  elle vient d'ou l'erreur ??




 
Moi aussi j'apprend XML pour mon stage !?
Mais c'est clair que ça va me servir après aussi ! Alors ça vaut l'investissement ( + j'ai du bol, ça passe en note de frais !  :D )

Reply

Marsh Posté le 02-07-2002 à 11:05:40    

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:

Reply

Marsh Posté le 02-07-2002 à 11:35:46    

ben ca fonctionne ca..

Reply

Marsh Posté le 02-07-2002 à 11:38:10    

swich a écrit a écrit :

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...
 




 
j'sais pas, dans ton copier coller, t'as plutot ca :
 
<?xml version="1.0" encoding="ISO8859-1"?>  

Reply

Marsh Posté le 02-07-2002 à 11:41:49    

exact....
 :jap:  
mais bon ca change rien :(

Reply

Marsh Posté le 02-07-2002 à 11:47:44    

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

Reply

Marsh Posté le 02-07-2002 à 12:29:02    

merci bien
je fais un copy paste du tiens, ca marche nickel...
bizzare
fo ke je matte ou l'erreur est  :heink:  

Reply

Marsh Posté le    

Reply

Sujets relatifs:

Leave a Replay

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