Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2789 connectés 

  FORUM HardWare.fr
  Programmation
  XML/XSL

  xml problème affichage dans Firefox

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

xml problème affichage dans Firefox

n°1926788
Scipion80
Posté le 25-09-2009 à 18:45:04  profilanswer
 

Bonjour
 
J'ai crée un fichier catalogue.xml
 

Code :
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <?xml-stylesheet version="1.1" type="text/xsl" href="catalogue.xsl"?>
  3. <catalogue>
  4.    <categorie>
  5.       <nom>A</nom>
  6.        <categorie>
  7.     <nom> ALBERT toto </nom>
  8.  <document>
  9.             <titre>Envoyer un message</titre>
  10.               <grade>xxx</grade>
  11.       <poste>yyyy</poste>
  12.       <secteur>zzzzzzzzzzzz</secteur>
  13.               <tel>00.00.00.00.00</tel>
  14.               <ref>mailto:xx@toto.fr</ref>
  15.  </document>       
  16. </categorie>
  17. </categorie>
  18. <categorie>
  19.       <nom>B</nom>
  20. <categorie> 
  21.           <nom>BONSOIR Vous</nom>
  22.  <document>
  23.   <titre>Envoyer un message</titre>
  24.          <grade>xxx</grade>
  25.          <poste>zzzz</poste>
  26.          <secteur>ffffffffffff</secteur>
  27.          <tel>00.00.00.00.01</tel>
  28.   <ref>mailto:zz@toto.fr</ref>
  29.   </document>
  30.     </categorie>
  31. </categorie>
  32. </catalogue>


 
j'ai crée un fichier catalogue.xls
 

Code :
  1. <?xml version="1.0" encoding="ISO-8859-1" ?>
  2. - <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/WD-xsl">
  3. - <xsl:template match="/">
  4. - <html>
  5. - <head>
  6.   <link rel="stylesheet" type="text/css" href="catalogue.css" />
  7.   <title>Annuaire </title>
  8.   <base target="_new" />
  9. - <script>
  10. - <xsl:comment>
  11. - <![CDATA[
  12. var deplier = true;
  13. var replier = false;
  14. function deplirepli(titre, depli)
  15. {
  16. plus = titre.children[0];
  17. moins = titre.children[1];
  18. div = titre.parentElement;
  19. moins.style.display = depli ? "" : "none";
  20. plus.style.display = depli ? "none" : "";
  21. titre.title="Cliquer pour " + (depli ? "re" : "dé" ) + "plier";
  22. div.children[1].style.display= depli ? "" : "none";
  23. }
  24. function deplirepliTout(action)
  25. {
  26. coll = document.all.tags("div" );
  27. for (i=0; i<coll.length; i++)
  28. {
  29. if (coll[i].className == "title" )
  30.  {
  31.  deplirepli(coll[i], action);
  32.  }
  33. }
  34. }
  35. function toggleDisplay(titre)
  36. {
  37. plus = titre.children[0];
  38. if (plus.style.display=="" )
  39. // déplier
  40. {
  41. deplirepli(titre, deplier);
  42. }
  43. else
  44. // replier
  45. {
  46. deplirepli(titre, replier);
  47. }
  48. }
  49. function display(identifieur)
  50. {
  51. if (identifieur!=null) {
  52. deplirepliTout(replier);
  53. personne=document.getElementById(identifieur);
  54. var parent=personne.parentNode;
  55. while (parent.tagName!="BODY" )
  56. {
  57. parent.style.display="";
  58. parent=parent.parentNode;
  59. }
  60. }
  61. nom = personne.children(0);
  62. nom.style.backgroundColor="navajowhite";
  63. nom.style.color="white";
  64. nom.style.fontSize="larger";
  65. document.location="#"+identifieur
  66. }
  67. function changeButton(selection)
  68. {
  69. document.all.bouton.title=document.getElementById(selection.value).children[0].innerText;
  70. }
  71.   ]]>
  72.   </xsl:comment>
  73.   </script>
  74.   </head>
  75. - <BODY>
  76. - <DIV id="listing">
  77.   <xsl:apply-templates select="catalogue" />
  78.   </DIV>
  79. - <P class="petit">
  80.   <A HREF="mailto:aaa@toto.fr">Signaler toute anomalie</A>
  81.   </P>
  82.   </BODY>
  83.   </html>
  84.   </xsl:template>
  85. - <xsl:template match="catalogue">
  86. - <h1 id="titre">
  87.   <input class="grosbouton" style="float:left" type="button" value="++" title="Tout déplier" onclick="deplirepliTout(deplier)" />
  88.   <input class="grosbouton" style="float:right" type="button" value="--" title="Tout replier" onclick="deplirepliTout(replier)" />
  89.   Annuaire
  90.   <span style="cursor:hand" title="Annuaire">HHHHH</span>
  91.   </h1>
  92.   <xsl:apply-templates select="categorie" order-by="nom" />
  93.   </xsl:template>
  94. - <xsl:template match="categorie">
  95. - <DIV CLASS="wrapping">
  96. - <DIV CLASS="title" onclick="toggleDisplay(this)">
  97. - <xsl:attribute name="title">
  98. - <xsl:if test="aide">
  99.   <xsl:value-of select="aide" />
  100.   <xsl:eval>"\r"</xsl:eval>
  101.   </xsl:if>
  102.   Cliquez vite pour en savoir plus
  103.   </xsl:attribute>
  104.   <SPAN>+</SPAN>
  105.   <SPAN STYLE="display:none">-</SPAN>
  106.   <xsl:value-of select="nom" />
  107.   </DIV>
  108. - <DIV CLASS="wrapping" STYLE="display:none">
  109.   <xsl:apply-templates select="categorie" order-by="nom" />
  110. - <xsl:if test="document">
  111. - <table class="persons">
  112.   <xsl:apply-templates select="document" order-by="titre" />
  113.   </table>
  114.   </xsl:if>
  115.   </DIV>
  116.   </DIV>
  117.   </xsl:template>
  118. - <xsl:template match="document">
  119. - <tr class="document">
  120. - <xsl:attribute name="ID">
  121.   <xsl:eval>uniqueID(this)</xsl:eval>
  122.   </xsl:attribute>
  123. - <td>
  124. - <a>
  125. - <xsl:attribute name="name">
  126.   <xsl:eval>uniqueID(this)</xsl:eval>
  127.   </xsl:attribute>
  128.   </a>
  129. - <a>
  130.   <xsl:attribute name="title">Cliquer pour envoyer un message</xsl:attribute>
  131. - <xsl:attribute name="href">
  132.   <xsl:value-of select="ref" />
  133.   </xsl:attribute>
  134.   <xsl:value-of select="titre" />
  135.   </a>
  136.   </td>
  137. - <td>
  138.   <xsl:value-of select="poste" />
  139.   </td>
  140. - <td>
  141.   <xsl:value-of select="secteur" />
  142.   </td>
  143. - <td>
  144.   <xsl:value-of select="tel" />
  145.   </td>
  146. - <td>
  147.   <xsl:value-of select="grade" />
  148.   </td>
  149.   </tr>
  150.   </xsl:template>
  151.   <xsl:script />
  152.   </xsl:stylesheet>


 
je n'ai aucun soucis pour visualiser le fichier xml dans Internet Explorer mais avec Firefox , j'ai le message suivant
Erreur lors du chargement de la feuille de style : Échec de l'analyse d'une feuille de style XSLT.
 
Où est l'erreur ?
 
Un grand merci d'avance à celui qui me donnera la solution


Message édité par Scipion80 le 26-09-2009 à 09:53:38
mood
Publicité
Posté le 25-09-2009 à 18:45:04  profilanswer
 

n°1927245
pataluc
Posté le 28-09-2009 à 11:43:32  profilanswer
 

plusieurs erreurs à priori:

 

- j'ai modifié l'entête, en reprenant un truc qui marchait de chez moi, et j'ai rajouté le xsl:output (je sais pas si c'est indispensable, mais ca marche avec)
- déja je sais pas pourquoi t'as des tirets devant la plupart de tes lignes, je suppose que c'est des erreurs de copier/coller, je les ai enlevé
- le order-by n'a plus l'air d'avoir cours, il est déprécié, il faut utiliser xsl:sort à la place
- le xsl:eval et le uniqueid, pareil, il faut mettre xsl:value-of avec un generate-id()
- t'as un "<xsl:script />" qui traine à la fin, qui n'a semble t'il rien à faire la

 

ca donne ca chez moi, et ca passe sous FF (par contre ya plus le sort, mais sinon c'est bon):

Code :
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <xsl:stylesheet
  3.    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  4.    version="1.0">        
  5.     <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
  6.  <xsl:template match="/">
  7.    <html>
  8.      <head>
  9.        <link rel="stylesheet" type="text/css" href="catalogue.css" />
  10.        <title>Annuaire</title>
  11.        <base target="_new" />
  12.        <script>
  13.          <xsl:comment>
  14.            <![CDATA[
  15.            var deplier = true;
  16.            var replier = false;
  17.            function deplirepli(titre, depli) {
  18.              plus = titre.children[0];
  19.              moins = titre.children[1];
  20.              div = titre.parentElement;
  21.              moins.style.display = depli ? "" : "none";
  22.              plus.style.display = depli ? "none" : "";
  23.              titre.title="Cliquer pour " + (depli ? "re" : "dé" ) + "plier";
  24.              div.children[1].style.display= depli ? "" : "none";
  25.            }
  26.            function deplirepliTout(action) {
  27.              coll = document.all.tags("div" );
  28.              for (i=0; i<coll.length; i++) {
  29.                if (coll[i].className == "title" ) {
  30.                  deplirepli(coll[i], action);
  31.                }
  32.              }
  33.            }
  34.            function toggleDisplay(titre) {
  35.              plus = titre.children[0];
  36.              if (plus.style.display=="" )
  37.            }
  38.            ]]>
  39.          </xsl:comment>
  40.        </script>
  41.      </head>
  42.      <BODY>
  43.        <DIV id="listing">
  44.          <xsl:apply-templates select="catalogue" />
  45.        </DIV>
  46.        <P class="petit">
  47.          <A HREF="mailto:aaa@toto.fr">Signaler toute anomalie</A>
  48.        </P>
  49.      </BODY>
  50.    </html>
  51.  </xsl:template>
  52.  <xsl:template match="catalogue">
  53.    <h1 id="titre">
  54.      <input class="grosbouton" style="float:left" type="button" value="++" title="Tout déplier" onclick="deplirepliTout(deplier)" />
  55.      <input class="grosbouton" style="float:right" type="button" value="--" title="Tout replier" onclick="deplirepliTout(replier)" />Annuaire
  56.      <span style="cursor:hand" title="Annuaire">HHHHH</span>
  57.    </h1>
  58.    <xsl:apply-templates select="categorie"/>
  59.  </xsl:template>
  60.  <xsl:template match="categorie">
  61.      <DIV CLASS="wrapping">
  62.        <DIV CLASS="title" onclick="toggleDisplay(this)">
  63.          <xsl:attribute name="title">
  64.            <xsl:if test="aide">
  65.              <xsl:value-of select="aide" />
  66.            </xsl:if>Cliquez vite pour en savoir plus</xsl:attribute>
  67.          <SPAN>+</SPAN>
  68.          <SPAN STYLE="display:none">-</SPAN>
  69.          <xsl:value-of select="nom" />
  70.        </DIV>
  71.        <DIV CLASS="wrapping" STYLE="display:none">
  72.          <xsl:apply-templates select="categorie"/>
  73.          <xsl:if test="document">
  74.            <table class="persons">
  75.              <xsl:apply-templates select="document" />
  76.            </table>
  77.          </xsl:if>
  78.        </DIV>
  79.      </DIV>
  80.  </xsl:template>
  81.  <xsl:template match="document">
  82.      <tr class="document">
  83.        <xsl:attribute name="ID">
  84.          <xsl:value-of select="generate-id()"/>
  85.        </xsl:attribute>
  86.        <td>
  87.          <a>
  88.            <xsl:attribute name="name">
  89.              <xsl:value-of select="generate-id()"/>
  90.            </xsl:attribute>
  91.          </a>
  92.          <a>
  93.            <xsl:attribute name="title">Cliquer pour envoyer un message</xsl:attribute>
  94.            <xsl:attribute name="href">
  95.              <xsl:value-of select="ref" />
  96.            </xsl:attribute>
  97.            <xsl:value-of select="titre" />
  98.          </a>
  99.        </td>
  100.        <td>
  101.          <xsl:value-of select="poste" />
  102.        </td>
  103.        <td>
  104.          <xsl:value-of select="secteur" />
  105.        </td>
  106.        <td>
  107.          <xsl:value-of select="tel" />
  108.        </td>
  109.        <td>
  110.          <xsl:value-of select="grade" />
  111.        </td>
  112.      </tr>
  113.  </xsl:template>
  114. </xsl:stylesheet>


Message édité par pataluc le 28-09-2009 à 11:45:35
n°1928056
Scipion80
Posté le 30-09-2009 à 20:23:41  profilanswer
 

Bonsoir pataluc et merci
 
bon j'ai essayé ton code mais cela ne marche pas ( j'ai dû me tromper en faisant le copier coller)
 
je vais essayer à nouveau
 
A noter : je débute complètement avec le xml
 
je ne sais pas pourquoi il y a des tirets car dans mon fichier il n'y en a pas
 
si tu veux tester sous Internet Exploer voici mon fichier catalogue.css
 

Code :
  1. body {
  2. font-size: small;
  3. background-color: #FFFFFF;
  4. font-family: Verdana, Arial, sans-serif;
  5. }
  6. H1, H2, H3, H4 {
  7. color:#258;
  8. }
  9. h1 {
  10. margin-top: 30px;
  11. text-align: center;
  12. font-size: 14pt;
  13. }
  14. h3 {
  15. letter-spacing: 5 px;
  16. font-weight: normal;
  17. }
  18. table.persons {
  19. width: 90%;
  20. background-color: #69C;
  21. border: outset;
  22. }
  23. table.persons th {
  24. color: white;
  25. text-transform: capitalize;
  26. letter-spacing: 0.5em;
  27. padding: 7px;
  28. }
  29. table.persons td {
  30. font-size: 10pt;
  31. padding: 7px;
  32. border: inset 2px;
  33. background-color: oldlace;
  34. }
  35. tr.chef td {
  36. background-color: navajowhite;
  37. }
  38. table.address {
  39. width: 90%;
  40. background-color: navajowhite;
  41. border: outset 5px;
  42. }
  43. table.address td {
  44. width: 90%;
  45. padding:10px;
  46. }
  47. .wrapping .wrapping {
  48. margin-left:20px;
  49. }
  50. .title {
  51. font-size: 10pt;
  52. color:#258;
  53. margin: 10px;
  54. cursor:hand;
  55. }
  56. .firstname {
  57. text-transform: uppercase;
  58. }
  59. .address {
  60. margin-bottom: 10px;
  61. margin-left: -20px;
  62. }
  63. #bouton {
  64. color: black;
  65. position: relative;
  66. top: 2;
  67. margin-top: 5px;
  68. }
  69. .grosbouton {
  70. font-weight: bold;
  71. font-size: 12pt;
  72. color: black;
  73. }
  74. form {
  75. margin: -20px;
  76. border: inset;
  77. text-align:center;
  78. color: white;
  79. background-color: #69C;
  80. padding: 10px;
  81. }
  82. .flag {
  83. width:26px;
  84. height:18px;
  85. float:right;
  86. }
  87. .petit {
  88. font-size:smaller
  89. }
  90. .pale {
  91. font-size:smaller;
  92. color: #69C;
  93. }
  94. legend {
  95. color:aquamarine;
  96. }
  97. fieldset {
  98. padding: 4px;
  99. }
  100. .premiermot {
  101. text-transform: capitalize;
  102. }


 
merci encore
 
A noter avec ie tab, cela fonctionne dans Firefox mais j'aimerai bien que cela fonction sans cette extension


Message édité par Scipion80 le 30-09-2009 à 20:24:31
n°1928287
cybrix
Posté le 01-10-2009 à 14:51:58  profilanswer
 

Bonjour,
 
J'ai déja eu ce problème et je crois que je l'avais corrigé en changeant l'extension de la feuille de style.
 
Essaye .xslt aulieu de .xls
 

n°1928617
Scipion80
Posté le 02-10-2009 à 18:39:22  profilanswer
 

Bonsoir  
 
Merci cybrix
 
j'ai essayé de modifier l'extension  
 
cela ne marche pas
 
Sous Internet explorer j'ai ceci
The system cannot locate the resource specified. Erreur de traitement de la ressource file:///F:/xxx/xxxx/catalogue1.x...
 
et sous Firefox, les données apparaissent les uns à la suite des autres, mais aucune mise en forme
 
 
 


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  XML/XSL

  xml problème affichage dans Firefox

 

Sujets relatifs
Probleme affichage simpleviewer avec firefoxProblème d'affichage de tableau : vertical Firefox / Horizontal IE
Probleme d'affichage de ma page sur firefoxprobleme d' affichage sous firefox
problème d'affichage IE/FirefoxPROBLEME D'AFFICHAGE SUR FIREFOX
Probleme d'affichage avec firefoxaffichage d'un swf: firefox ok, IE probleme !
[Flash/AS] problème d'affichage avec FirefoxProbléme affichage image avec firefox sur smartblog
Plus de sujets relatifs à : xml problème affichage dans Firefox


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR