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 :

[XSL] recherche feuille XSLT 1.0 IE


Sujet :

XSL/XSLT/XPATH XML

  1. #1
    Futur Membre du Club
    Inscrit en
    Juillet 2003
    Messages
    7
    Détails du profil
    Informations forums :
    Inscription : Juillet 2003
    Messages : 7
    Points : 7
    Points
    7
    Par défaut [XSL] recherche feuille XSLT 1.0 IE
    Bonjour,

    je cherche une feuille XSL qui fasse le meme travail que celle utilisée par défault par IE . Une question avait été posée sur ce forum à ce sujet, mais la réponse proposée était la feuille XSL réellement utilisée par IE, mais qui n'est pas conforme à conforme à XSLT 1.0. (version draft XSL).

    Alors , comme conseillé dans le forum, je veux utiliser la version release du XSL, et j'aimerais savoir si quelqu'un a un exemple XSL au bon format qui transforme les fichiers XML un peu comme le fait IE ?

    Merci beaucoup par avance !

  2. #2
    Membre averti
    Profil pro
    Inscrit en
    Janvier 2003
    Messages
    284
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2003
    Messages : 284
    Points : 349
    Points
    349
    Par défaut
    Ca devrait faire l'affaire :

    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
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
     
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xslc="http://xslcomponents.org/TR/WD-xslc">
    <xsl:template name="XMLViewer.Head">
    <xsl:param name="Delta">0</xsl:param>
    <xsl:choose>
    <xsl:when test="$Delta = '1'">
    <style><![CDATA[.c  {cursor:hand}
    .b  {color:red; font-family:'Courier New'; font-weight:bold; text-decoration:none}
    a.b {color:red; font-family:'Courier New'; font-weight:bold; text-decoration:none}
    a.b:hover {color:red; font-family:'Courier New'; font-weight:bold; text-decoration:none}
    a.b:active {color:red; font-family:'Courier New'; font-weight:bold; text-decoration:none}
    a.b:visited {color:red; font-family:'Courier New'; font-weight:bold; text-decoration:none}
    .t  {color:#990000}
    .xt {color:#990099}
    .ns {color:red}
    .dt {color:green}
    .m  {color:blue}
    .tx {}
    .txb {font-weight:bold}
    .di {font:small Courier}
    .d  {color:blue}
    .pi {color:blue}
    .cb {text-indent:0px; margin-left:1em; margin-top:0px; margin-bottom:0px; 
      padding-left:.3em; font:small Courier; color:#888888}
    .ci {font:small Courier; color:#888888}
    PRE {margin:0px; display:inline}    ]]></style>
    </xsl:when>
    <xsl:otherwise>
    <style><![CDATA[.c  {cursor:hand}
    .b  {color:red; font-family:'Courier New'; font-weight:bold; text-decoration:none}
    a.b {color:red; font-family:'Courier New'; font-weight:bold; text-decoration:none}
    a.b:hover {color:red; font-family:'Courier New'; font-weight:bold; text-decoration:none}
    a.b:active {color:red; font-family:'Courier New'; font-weight:bold; text-decoration:none}
    a.b:visited {color:red; font-family:'Courier New'; font-weight:bold; text-decoration:none}
    .t  {color:#990000}
    .xt {color:#990099}
    .ns {color:red}
    .dt {color:green}
    .m  {color:blue}
    .tx {font-weight:bold}
    .txb {font-weight:bold}
    .di {font:small Courier}
    .d  {color:blue}
    .pi {color:blue}
    .cb {text-indent:0px; margin-left:1em; margin-top:0px; margin-bottom:0px; 
      padding-left:.3em; font:small Courier; color:#888888}
    .ci {font:small Courier; color:#888888}
    PRE {margin:0px; display:inline}    ]]></style>
    </xsl:otherwise>
    </xsl:choose>
    <script language="javascript"><![CDATA[function get(ID) {
      if (document.getElementById)
        return document.getElementById(ID);
      else if (document.all)
        return document.all(ID);
      else 
        return null;
    }
     
    function sh(ID) {
      div = get('div_'+ID);
      if (div == null) return;
      btn = get('btn_'+ID);
      if (div.style.display == 'none') {
        div.style.display = '';
        if (btn != null)
          btn.innerText = '-';
      }
      else {
        div.style.display = 'none';
        if (btn != null)
          btn.innerText = '+';
      }
    }]]></script>
    </xsl:template>
    <xsl:template match="/" mode="XMLMode">
    <xsl:apply-templates mode="XMLMode"/>
    </xsl:template>
    <xsl:template match="@*" mode="XMLMode">
    <xsl:if test="name() != 'XMLC_Expanded' and name() != 'XMLC_Deleted' and name() != 'XMLC_Inserted' and name() != 'XMLC_Updated'">
    <span class="t"> <xsl:value-of select="name()"/>
    </span>
    <span class="m">="</span>
    <span class="tx">
    <xsl:value-of select="."/>
    </span>
    <span class="m">"</span>
    </xsl:if>
    </xsl:template>
    <!-- Template for text nodes -->
    <xsl:template match="text()" mode="XMLMode">
    <div>
    <span class="b">
    <xsl:text disable-output-escaping="yes"/>
    </span>
    <span class="tx">
    <xsl:value-of select="."/>
    </span>
    </div>
    </xsl:template>
    <!-- Template for comment nodes -->
    <xsl:template match="comment()" mode="XMLMode">
    <div>
    <span>
    <span class="ci">&lt;!--</span>
    </span>
    <span id="clean" class="ci">
    <PRE>
    <xsl:value-of select="."/>
    </PRE>
    </span>
    <span class="ci">--&gt;</span>
    </div>
    </xsl:template>
    <!-- Template for elements not handled elsewhere (leaf nodes) -->
    <xsl:template match="*" mode="XMLMode">
    <div style="padding-left: 26px;">
    <div>
    <xsl:if test="@XMLC_Expanded and @XMLC_Expanded = '1'">
    <xsl:attribute name="class">txb</xsl:attribute>
    </xsl:if>
    <span class="m">&lt;</span>
    <span class="t">
    <xsl:value-of select="name()"/>
    </span>
    <xsl:apply-templates mode="XMLMode" select="@*"/>
    <span class="m">/&gt;</span>
    </div>
    </div>
    </xsl:template>
    <!-- Template for elements with comment, pi and/or cdata children -->
    <xsl:template match="*[node()]" mode="XMLMode">
    <xsl:variable name="id" select="generate-id()"/>
    <div>
    <div onclick="sh('{$id}');">
    <xsl:attribute name="class"><xsl:choose><xsl:when test="@XMLC_Expanded and @XMLC_Expanded = '1'">cb</xsl:when><xsl:otherwise>c</xsl:otherwise></xsl:choose></xsl:attribute>
    <span id="btn_{$id}" class="b" style="margin-right: 4px;">
    <xsl:choose>
    <xsl:when test="@XMLC_Expanded and @XMLC_Expanded = '0'">+</xsl:when>
    <xsl:otherwise>-</xsl:otherwise>
    </xsl:choose>
    </span>
    <span class="m">&lt;</span>
    <span class="t">
    <xsl:value-of select="name()"/>
    </span>
    <xsl:apply-templates mode="XMLMode" select="@*"/>
    <span class="m">&gt;</span>
    </div>
    <div id="div_{$id}">
    <xsl:if test="@XMLC_Expanded and @XMLC_Expanded = '0'">
    <xsl:attribute name="style">display: none;</xsl:attribute>
    </xsl:if>
    <xsl:apply-templates mode="XMLMode"/>
    <div>
    <span class="m">&lt;/</span>
    <span class="t">
    <xsl:value-of select="name()"/>
    </span>
    <span class="m">&gt;</span>
    </div>
    </div>
    </div>
    </xsl:template>
    <!-- Template for elements with only text children -->
    <xsl:template match="*[text() and not(comment())]" mode="XMLMode">
    <div style="padding-left: 26px;">
    <div>
    <span class="m">&lt;</span>
    <span class="t">
    <xsl:if test="@XMLC_Expanded and @XMLC_Expanded = '1'">
    <xsl:attribute name="style">font-weight: bold</xsl:attribute>
    </xsl:if>
    <xsl:value-of select="name()"/>
    </span>
    <xsl:apply-templates mode="XMLMode" select="@*"/>
    <span class="m">&gt;</span>
    <span class="tx">
    <xsl:if test="@XMLC_Expanded and @XMLC_Expanded = '1'">
    <xsl:attribute name="style">font-weight: bold</xsl:attribute>
    </xsl:if>
    <xsl:value-of select="."/>
    </span>
    <span class="m">&lt;/</span>
    <span class="t">
    <xsl:if test="@XMLC_Expanded and @XMLC_Expanded = '1'">
    <xsl:attribute name="style">font-weight: bold</xsl:attribute>
    </xsl:if>
    <xsl:value-of select="name()"/>
    </span>
    <span class="m">&gt;</span>
    </div>
    </div>
    </xsl:template>
    <!-- Template for elements with element children -->
    <xsl:template match="*[*]" mode="XMLMode">
    <xsl:variable name="id" select="generate-id()"/>
    <div style="padding-left: 12px;">
    <div class="c" onclick="sh('{$id}');">
    <span id="btn_{$id}" class="b" style="margin-right: 4px;">
    <xsl:choose>
    <xsl:when test="@XMLC_Expanded and @XMLC_Expanded = '0'">+</xsl:when>
    <xsl:otherwise>-</xsl:otherwise>
    </xsl:choose>
    </span>
    <span class="m">&lt;</span>
    <span class="t">
    <xsl:if test="@XMLC_Expanded and @XMLC_Expanded = '1'">
    <xsl:attribute name="style">font-weight: bold</xsl:attribute>
    </xsl:if>
    <xsl:value-of select="name()"/>
    </span>
    <xsl:apply-templates mode="XMLMode" select="@*"/>
    <span class="m">&gt;</span>
    </div>
    <div id="div_{$id}">
    <xsl:if test="@XMLC_Expanded and @XMLC_Expanded = '0'">
    <xsl:attribute name="style">display: none;</xsl:attribute>
    </xsl:if>
    <xsl:apply-templates mode="XMLMode"/>
    <div style="padding-left: 12px;">
    <span class="m">&lt;/</span>
    <span class="t">
    <xsl:if test="@XMLC_Expanded and @XMLC_Expanded = '1'">
    <xsl:attribute name="style">font-weight: bold</xsl:attribute>
    </xsl:if>
    <xsl:value-of select="name()"/>
    </span>
    <span class="m">&gt;</span>
    </div>
    </div>
    </div>
    </xsl:template>
    </xsl:stylesheet>

  3. #3
    Futur Membre du Club
    Inscrit en
    Juillet 2003
    Messages
    7
    Détails du profil
    Informations forums :
    Inscription : Juillet 2003
    Messages : 7
    Points : 7
    Points
    7
    Par défaut
    merci !

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 5
    Dernier message: 02/12/2005, 13h01
  2. Executer une feuille XSLT sur du xml
    Par naiadeKaren dans le forum Général Python
    Réponses: 2
    Dernier message: 24/08/2005, 14h53
  3. namespace dans feuille xslt : comment ca marche exactement ?
    Par guipom dans le forum XSL/XSLT/XPATH
    Réponses: 13
    Dernier message: 11/11/2004, 16h21
  4. pb eval pour le code php dans une feuille xslt
    Par nipepsi dans le forum XSL/XSLT/XPATH
    Réponses: 8
    Dernier message: 10/09/2004, 11h23

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