IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

XSL/XSLT/XPATH XML Discussion :

[XSLT] problème transformation XSLT [Débutant(e)]


Sujet :

XSL/XSLT/XPATH XML

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Juin 2002
    Messages
    162
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2002
    Messages : 162
    Points : 72
    Points
    72
    Par défaut [XSLT] problème transformation XSLT
    Bonjour,

    Voilà je n'y connais vraiment pas grand chose en XSL...Or, on m'a donné un fichier XML avec la feuille de style XSLT qui va avec et je n'ai en principe qu'à appliquer bêtement une transformation XSLT pour obtenir la page HTML qui va bien...

    Globalement ça marche très bien à l'exception d'une partie de mon fichier XML que je ne retrouve pas du tout dans le HTML. J'essaie de me plonger dans le fichier XSLvoir ce qui cloche mais il est vraiment complexe pour qqn comme moi qui n'y connait rien...

    Voilà le code XML qui ne sort pas dans le HTML :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    <REFERENCE-BIBLIOGRAPHIQUE ID="Chap3-bib1">
    <REF-ARTICLE-REVUE><REF-AUTEUR-LIST><REF-AUTEUR><REF-NOM><PC>remontet</PC></REF-NOM>
    <REF-INITIALES-PRENOM><PC>l</PC></REF-INITIALES-PRENOM></REF-AUTEUR>
    <REF-AUTEUR><REF-NOM><PC>esteve</PC></REF-NOM><REF-INITIALES-PRENOM><PC>j</PC></REF-INITIALES-PRENOM></REF-AUTEUR>
    <REF-AUTEUR><REF-NOM><PC>bouvier</PC></REF-NOM><REF-INITIALES-PRENOM><PC>am</PC></REF-INITIALES-PRENOM></REF-AUTEUR>
    <REF-AUTEUR><REF-NOM><PC>grosclaude</PC></REF-NOM>
    <REF-INITIALES-PRENOM><PC>p</PC></REF-INITIALES-PRENOM></REF-AUTEUR>
    <REF-AUTEUR><REF-NOM><PC>launoy</PC></REF-NOM><REF-INITIALES-PRENOM><PC>g</PC></REF-INITIALES-PRENOM></REF-AUTEUR></REF-AUTEUR-LIST>
    <REF-TITRE-ARTICLE>Cancer incidence and mortality in France over the period 1978-2000</REF-TITRE-ARTICLE><REF-NOM-REVUE>Rev Epidemiol Sante Publique</REF-NOM-REVUE><REF-ANNEE>2003</REF-ANNEE><REF-VOLUME>
    <REF-NUMERO>51</REF-NUMERO></REF-VOLUME><REF-PAGE-DEBUT>3</REF-PAGE-DEBUT>
    <REF-PAGE-FIN>30</REF-PAGE-FIN></REF-ARTICLE-REVUE></REFERENCE-BIBLIOGRAPHIQUE>
    Et voilà des morceaux du fichier XSL qui est censé s'occuper de ça :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    <xsl:template match="REFERENCE-BIBLIOGRAPHIQUE">
      <xsl:choose>
    	  <xsl:when test="count(//GENERATION-REFERENCES-SECT-BIBLIOGRAPHIE)">
    	    <FONT CLASS="REFERENCE-BIBLIOGRAPHIQUE-NUMERO">[<xsl:number format="1" level="any" 
    	               from="INSERM-QUESTIONS-SANTE-EXPERTISE"/>
    		    <xsl:for-each select="./REF-PAGE-DEBUT">
    		      <xsl:if test="position()=1">:<xsl:value-of select="."/><xsl:if test="following-sibling::*[1][self::REF-PAGE-FIN]">-<xsl:value-of select="following-sibling::*[1]"/></xsl:if></xsl:if>]
    		      <xsl:if test="position()>1">,<xsl:value-of select="."/><xsl:if test="following-sibling::*[1][self::REF-PAGE-FIN]">-<xsl:value-of select="following-sibling::*[1]"/></xsl:if></xsl:if>
    		    </xsl:for-each>]</FONT>
        </xsl:when>
        <xsl:otherwise>  
    	    <FONT CLASS="REFERENCE-BIBLIOGRAPHIQUE-NUMERO">[<xsl:number format="1" level="any" 
    	               from="CHAPITRE-QUESTIONS|CHAPITRE-EXPERTISE|SYNTHESE|RECOMMANDATION-ANALYSE|RECOMMANDATION-SYNTHESE|
    	               CHAPITRE-COMMUNICATION|SECT-INTRODUCTION|SECT-CONCLUSION"/>
    		    <xsl:for-each select="./REF-PAGE-DEBUT">
    		      <xsl:if test="position()=1">:<xsl:value-of select="."/><xsl:if test="following-sibling::*[1][self::REF-PAGE-FIN]">-<xsl:value-of select="following-sibling::*[1]"/></xsl:if></xsl:if>]
    		      <xsl:if test="position()>1">,<xsl:value-of select="."/><xsl:if test="following-sibling::*[1][self::REF-PAGE-FIN]">-<xsl:value-of select="following-sibling::*[1]"/></xsl:if></xsl:if>
    		    </xsl:for-each>]</FONT>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:template>
     
    <xsl:template match="REF-AUTEUR-LIST" mode="REF">
      <xsl:apply-templates mode="REF"/><xsl:if test="not(count(REF-ANONYME))">.</xsl:if>
    </xsl:template>
     
    <xsl:template match="REF-ARTICLE-LIVRE|REF-LIVRE|REF-THESE" mode="REF">
    <xsl:apply-templates mode="REF"/>.
    </xsl:template>
     
    <xsl:template match="REF-TITRE-ARTICLE|REF-TITRE-LIVRE|REF-NUMERO-EDITION|
                        REF-ARTICLE-LIVRE/REF-ANNEE|REF-LIVRE/REF-ANNEE|
                        REF-TYPE-THESE|REF-LIEU|REF-TITRE-SUJET|REF-PAYS" mode="REF">
       <xsl:apply-templates/>.
    </xsl:template>
     
    <xsl:template match="REF-TYPE-ARTICLE" mode="REF">
       {<xsl:apply-templates/>}
    </xsl:template>
     
    <xsl:template match="REF-AUTEUR" mode="REF">
      <xsl:apply-templates mode="REF"/><xsl:if test="following-sibling::*[1][self::REF-AUTEUR]">,</xsl:if>
    </xsl:template>
     
    <xsl:template match="REF-NOM|REF-INITIALES-PRENOM" mode="REF">  
      <xsl:apply-templates/><xsl:if test="name()=REF-NOM"> </xsl:if>
    </xsl:template>
     
    <xsl:template match="REF-NOM-REVUE" mode="REF">  
       <xsl:apply-templates/>
    </xsl:template>
     
    <xsl:template match="REF-TITRE-ARTICLE">
    <b>coucou</b>
    </xsl:template>
    <xsl:template match="REF-ARTICLE-REVUE/REF-ANNEE|REF-MAISON-EDITION|
                        REF-TITRE-CONF|REF-DATE" mode="REF">  
     
       <xsl:apply-templates/>;
    </xsl:template>
     
    <xsl:template match="REF-VOLUME|REF-VILLE" mode="REF">
      <xsl:choose>
    	  <xsl:when test="name()='REF-VILLE' and (name(..)='REF-CONF-PRO' or name(..)='REF-CONF')">
    		   <xsl:apply-templates/>,
    	  </xsl:when>
    	  <xsl:otherwise>
    		   <xsl:apply-templates/>:
    	  </xsl:otherwise>
      </xsl:choose>
    </xsl:template>
     
    <xsl:template match="REF-SUPPLEMENT" mode="REF">
       Suppl <xsl:apply-templates/>
    </xsl:template>
     
    <xsl:template match="REF-PARTIE" mode="REF">
      <xsl:choose>
        <xsl:when test="name(..)=REF-FASCICULE">
           Pt <xsl:apply-templates/>
        </xsl:when>
        <xsl:otherwise>
          (Pt <xsl:apply-templates/>)
        </xsl:otherwise>
      </xsl:choose>
    </xsl:template>
     
    <xsl:template match="REF-FASCICULE" mode="REF">  
      (<xsl:apply-templates/>)
    </xsl:template>
     
    <xsl:template match="REF-FASCICULE" mode="REF">  
      (<xsl:apply-templates/>)
    </xsl:template>
     
    <xsl:template match="REF-ORGANISME|REF-REDACTEUR|REF-NUMERO|REF-LIBRE" mode="REF">  
      <xsl:apply-templates/>
    </xsl:template>
     
    <xsl:template match="REF-ARTICLE-REVUE/REF-PAGE-DEBUT" mode="REF">
      :<xsl:apply-templates mode="REF"/>
    </xsl:template>
     
    <xsl:template match="REF-ARTICLE-LIVRE/REF-PAGE-DEBUT" mode="REF">
       p. <xsl:apply-templates mode="REF"/>
    </xsl:template>
     
    <xsl:template match="REF-GRP-EDITEUR" mode="REF">
       In: <xsl:apply-templates mode="REF"/>editors.
    </xsl:template>
     
    <xsl:template match="REF-EDITEUR" mode="REF">
      <xsl:apply-templates mode="REF"/>, 
    </xsl:template>
     
    <xsl:template match="REF-ARTICLE-REVUE/REF-PAGE-FIN|REF-ARTICLE-LIVRE/REF-PAGE-FIN" mode="REF">
      -<xsl:apply-templates mode="REF"/>
    </xsl:template>
     
    <xsl:template match="REF-NB-PAGES" mode="REF">
       <xsl:apply-templates mode="REF"/> pages</xsl:template>
     
    <xsl:template match="REF-PRENOM|REF-ANONYME" mode="REF">  
    </xsl:template>
    Pour info le seul résultat que j'obtiens dans le HTML est ceci :
    <FONT CLASS="REFERENCE-BIBLIOGRAPHIQUE-NUMERO">[1]</FONT>
    Il manque donc toute la partie concernant les auteurs, l'article ...
    J'ai bien conscience que c'est très long et que ça ne doit pas être facile à étudier comme ça mais si vous avez la moindre piste je suis preneuse car je nage depuis plusieurs jours avec cette histoire...

    Merci beaucoup!!

  2. #2
    Membre éclairé
    Avatar de marabout
    Homme Profil pro
    Consultant E-Learning
    Inscrit en
    Août 2006
    Messages
    650
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Consultant E-Learning

    Informations forums :
    Inscription : Août 2006
    Messages : 650
    Points : 852
    Points
    852
    Par défaut
    Pourrais-tu joindre les fichiers complets car nous n'avons qu'une partie du code et pas assez pour tester et te répondre... ?

  3. #3
    Membre régulier
    Profil pro
    Inscrit en
    Juin 2002
    Messages
    162
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2002
    Messages : 162
    Points : 72
    Points
    72
    Par défaut
    Pas de souci je joins le fichier XML et le fichier XSL...
    Merci
    Fichiers attachés Fichiers attachés

Discussions similaires

  1. transformation xslt
    Par yos dans le forum XSL/XSLT/XPATH
    Réponses: 3
    Dernier message: 05/07/2005, 16h43
  2. transformation xslt
    Par yos dans le forum XSL/XSLT/XPATH
    Réponses: 2
    Dernier message: 28/06/2005, 16h46
  3. xhtml-->xml transformation xslt
    Par yos dans le forum XSL/XSLT/XPATH
    Réponses: 10
    Dernier message: 15/06/2005, 15h23
  4. xhtml->xml transformation xslt
    Par yos dans le forum XSL/XSLT/XPATH
    Réponses: 6
    Dernier message: 14/06/2005, 11h17
  5. [XSLT] Récupération de la transformation Xslt
    Par Pignoufy dans le forum Format d'échange (XML, JSON...)
    Réponses: 4
    Dernier message: 06/04/2005, 15h11

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo