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] Regrouper/Restructurer xml/xsl


Sujet :

XSL/XSLT/XPATH XML

  1. #1
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Octobre 2009
    Messages
    1
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2009
    Messages : 1
    Points : 1
    Points
    1
    Par défaut [XSLT] Regrouper/Restructurer xml/xsl
    Bonjour à tous,

    C'est mon 1er message sur ce forum, je fais appel aux érudits du xsl ;

    Ma demande concerne un regroupement d'une structure xml qui se répète, en 1 seule structure.

    Xml d'entrée :

    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
    <?xml version="1.0" encoding="UTF-8"?>
    <document>   
        <archive>
            <version_arch date="20091015" id="1">
                <metadata>
                    <model>advice</model>
                </metadata>
                <content>
                    <fr>
                        <title>title version 1</title>
                        <short_title>short title version 1</short_title>
                        <situation>
                            <html>
                                <body>
                                    <p>situation version 1</p>
                                </body>
                            </html>
                        </situation>
                        <opinion>
                            <html>
                                <body>
                                    <p>avis version 1</p>
                                </body>
                            </html>
                        </opinion>
                        <justification>
                            <html>
                                <body>
                                    <p>justification version 1</p>
                                </body>
                            </html>
                        </justification>
                    </fr>
                    <nl>
                        <title>title nl version 1</title>
                        <short_title>short title nl version 1</short_title>
                        <situation>
                            <html>
                                <body>
                                    <p>situation nl version 1</p>
                                </body>
                            </html>
                        </situation>
                        <opinion>
                            <html>
                                <body>
                                    <p>avis nl version 1</p>
                                </body>
                            </html>
                        </opinion>
                        <justification>
                            <html>
                                <body>
                                    <p>justification nl version 1</p>
                                </body>
                            </html>
                        </justification>
                    </nl>
                    <de>
                        <title/>
                        <short_title/>
                        <situation/>
                        <opinion/>
                        <justification/>
                    </de>
                </content>
            </version_arch>
            <version_arch date="20091015" id="2">
                <metadata>
                    <model>advice</model>
                </metadata>
                <content>
                    <fr>
                        <title>title version 2</title>
                        <short_title>short title version 2</short_title>
                        <situation>
                            <html>
                                <body>
                                    <p>situationversion 2</p>
                                </body>
                            </html>
                        </situation>
                        <opinion>
                            <html>
                                <body>
                                    <p>avis version 2</p>
                                </body>
                            </html>
                        </opinion>
                        <justification>
                            <html>
                                <body>
                                    <p>justification version 2</p>
                                </body>
                            </html>
                        </justification>
                    </fr>
                    <nl>
                        <title>title nl version 2</title>
                        <short_title>short title nl version 2</short_title>
                        <situation>
                            <html>
                                <body>
                                    <p>situation nlversion 2</p>
                                </body>
                            </html>
                        </situation>
                        <opinion>
                            <html>
                                <body>
                                    <p>avis nl version 2</p>
                                </body>
                            </html>
                        </opinion>
                        <justification>
                            <html>
                                <body>
                                    <p>justification nl version 2</p>
                                </body>
                            </html>
                        </justification>
                    </nl>
                    <de>
                        <title/>
                        <short_title/>
                        <situation/>
                        <opinion/>
                        <justification/>
                    </de>
                </content>
            </version_arch>
            <version_arch date="20091015" id="3">
                <metadata>
                    <model>advice</model>
                </metadata>
                <content>
                    <fr>
                        <title>title version 3</title>
                        <short_title>short title version 3</short_title>
                        <situation>
                            <html>
                                <body>
                                    <p>situation version 3</p>
                                </body>
                            </html>
                        </situation>
                        <opinion>
                            <html>
                                <body>
                                    <p>avis version 3</p>
                                </body>
                            </html>
                        </opinion>
                        <justification>
                            <html>
                                <body>
                                    <p>justification version 3</p>
                                </body>
                            </html>
                        </justification>
                    </fr>
                    <nl>
                        <title>title nl version 3</title>
                        <short_title>short title nl version 3</short_title>
                        <situation>
                            <html>
                                <body>
                                    <p>situation nl version 3</p>
                                </body>
                            </html>
                        </situation>
                        <opinion>
                            <html>
                                <body>
                                    <p>avis nl version 3</p>
                                </body>
                            </html>
                        </opinion>
                        <justification>
                            <html>
                                <body>
                                    <p>justification nl version 3</p>
                                </body>
                            </html>
                        </justification>
                    </nl>
                    <de>
                        <title/>
                        <short_title/>
                        <situation/>
                        <opinion/>
                        <justification/>
                    </de>
                </content>
            </version_arch>
        </archive>
    </document>
    J'ai donc en entrée, 3 fois la même structure "version_arch"

    Xml de sortie souhaité :

    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
     
    <?xml version="1.0" encoding="utf-8"?>
    <document>
    <editing>
    <metadata>
         <model>advice</model>
    </metadata>
    <content>
                    <fr>
                        <title>title version 1</title>
                        <title>title version 2</title>
                        <title>title version 3</title>
                        <short_title>short title version 1</short_title>
                        <short_title>short title version 2</short_title>
                        <short_title>short title version 3</short_title>
                        <situation>
                            <html>
                                <body>
                                    <p>situationversion 1</p>
                                </body>
                            </html>
                        </situation>
                        <situation>
                            <html>
                                <body>
                                    <p>situationversion 2</p>
                                </body>
                            </html>
                        </situation>
                        <situation>
                            <html>
                                <body>
                                    <p>situationversion 3</p>
                                </body>
                            </html>
                        </situation>
                        <opinion>
                            <html>
                                <body>
                                    <p>avis version 1</p>
                                </body>
                            </html>
                        </opinion>
                        <opinion>
                            <html>
                                <body>
                                    <p>avis version 2</p>
                                </body>
                            </html>
                        </opinion>
                        <opinion>
                            <html>
                                <body>
                                    <p>avis version 3</p>
                                </body>
                            </html>
                        </opinion>
                        <justification>
                            <html>
                                <body>
                                    <p>justification version 1</p>
                                </body>
                            </html>
                        </justification>
                        <justification>
                            <html>
                                <body>
                                    <p>justification version 2</p>
                                </body>
                            </html>
                        </justification>
                        <justification>
                            <html>
                                <body>
                                    <p>justification version 3</p>
                                </body>
                            </html>
                        </justification>
                    </fr>
                    <nl>
                        [...]
                    </nl>
                    <de>
                        [...]
                    </de>
                </content>
        </editing>
    </document>

    Je dois donc regrouper en 1 structure, ce qui se trouve dans <content>. Je suis conscient que cette "structure" n'est pas ce qu'il y'a de mieux, mais des contraintes m'empêchent de faire autrement.

    N'hésitez-pas si vous voulez plus d'infos.

    Tout conseil, astuce sont bienvenus, et je vous en remercie d'avance

  2. #2
    Rédacteur

    Avatar de Erwy
    Homme Profil pro
    Développeur Web
    Inscrit en
    Novembre 2003
    Messages
    4 967
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Novembre 2003
    Messages : 4 967
    Points : 10 927
    Points
    10 927
    Par défaut
    Tu as jeter un oeil ici
    Comment regrouper les noeuds en fonction de leurs éléments qui se ressemblent ?

    tu peux regarder aussi cette discussion tu y trouveras peut être des idées
    http://www.developpez.net/forums/d82...p-by-group-by/

Discussions similaires

  1. [XSLT] Regroupement ds XML
    Par Virginie dans le forum XSL/XSLT/XPATH
    Réponses: 1
    Dernier message: 19/10/2006, 12h35
  2. [XSLT] Regroupement en utilsant xsl:key
    Par AVRAVR dans le forum XSL/XSLT/XPATH
    Réponses: 5
    Dernier message: 28/07/2006, 10h02
  3. [XSLT] Comment optimiser les traitements XML/XSL ?
    Par thibaut06 dans le forum Bibliothèques et frameworks
    Réponses: 1
    Dernier message: 24/03/2006, 16h39
  4. [XSLT][DOM] Php - Xml - Xsl
    Par topolino dans le forum Bibliothèques et frameworks
    Réponses: 3
    Dernier message: 08/12/2005, 19h34
  5. EXTENSIONS XML, XSL, XSLT, sur internet explorer 6 pack 2
    Par superjeanpi dans le forum XSL/XSLT/XPATH
    Réponses: 5
    Dernier message: 08/12/2004, 12h11

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