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 :

Extraction de données avec XSL sur des XML avec namespace


Sujet :

XSL/XSLT/XPATH XML

  1. #1
    Expert éminent sénior

    Avatar de snake264
    Homme Profil pro
    Datascientist chez Leboncoin
    Inscrit en
    Novembre 2006
    Messages
    2 914
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Datascientist chez Leboncoin
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Novembre 2006
    Messages : 2 914
    Points : 13 312
    Points
    13 312
    Par défaut Extraction de données avec XSL sur des XML avec namespace
    Bonjour,

    Voilà, j'ai ce fichier XML :

    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
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <ChouettePTNetwork xmlns="http://www.trident.org/schema/trident"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://www.trident.org/schema/trident neptune.xsd"><ChouetteArea>
            <StopArea>
                <objectId>CG33:StopArea:21499</objectId>
                <objectVersion>1</objectVersion>
                <creationTime>2011-11-15T10:15:01.000+01:00</creationTime>
                <name>AMBARES   Bellevue</name>
                <contains>CG33:StopPoint:15</contains>
                <contains>CG33:StopPoint:70</contains>
                <centroidOfArea>CG33:Place:3433040</centroidOfArea>
                <StopAreaExtension>
                    <areaType>BoardingPosition</areaType>
                    <fareCode>1</fareCode>
                </StopAreaExtension>
            </StopArea>
            <StopArea>
                <objectId>CG33:StopArea:11146</objectId>
                <objectVersion>1</objectVersion>
                <creationTime>2011-11-15T10:15:01.000+01:00</creationTime>
                <name>AMBARES   La Grave d Ambares</name>
                <contains>CG33:StopPoint:13</contains>
                <contains>CG33:StopPoint:68</contains>
                <contains>CG33:StopPoint:123</contains>
                <contains>CG33:StopPoint:177</contains>
                <contains>CG33:StopPoint:260</contains>
                <contains>CG33:StopPoint:313</contains>
                <contains>CG33:StopPoint:367</contains>
                <contains>CG33:StopPoint:420</contains>
                <centroidOfArea>CG33:Place:3432984</centroidOfArea>
                <StopAreaExtension>
                    <areaType>BoardingPosition</areaType>
                    <fareCode>1</fareCode>
                </StopAreaExtension>
            </StopArea>
    </ChouettePTNetwork>
    Ce fichier XSL :

    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
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                      xmlns:trident="http://www.trident.org/schema/trident">
     
    <xsl:template match="/">
        <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
            xmlns:neptune="http://data.lirmm.fr/ontologies/neptune/">
            <neptune:ChouettePTNetwork>
                  <neptune:hasChouetteArea>
                        <neptune:ChouetteArea>
                            <xsl:for-each select="trident:ChouettePTNetwork/trident:chouetteArea/trident:StopArea">
                                <neptune:hasStopArea>
                                    <neptune:StopArea>
                                      <neptune:objectId>trident:ChouettePTNetwork/trident:StopArea/trident:objectId</neptune:objectId>
                                        <neptune:objectVersion>trident:ChouettePTNetwork/trident:StopArea/trident:objectVersion</neptune:objectVersion>
                                        <neptune:creationTime>trident:ChouettePTNetwork/trident:StopArea/trident:creationTime</neptune:creationTime>
                                        <neptune:name>trident:ChouettePTNetwork/trident:StopArea/trident:name</neptune:name>
                                        <neptune:contains>trident:ChouettePTNetwork/trident:StopArea/trident:contains</neptune:contains>
                                        <neptune:centroidOfArea></neptune:centroidOfArea>
                                        <neptune:comment></neptune:comment>
                                        <neptune:hasStopAreaExtension>
                                            <neptune:StopAreaExtension>
                                                <neptune:areaType>trident:ChouettePTNetwork/trident:StopArea/trident:StopAreaExtension/trident:areaType</neptune:areaType>
                                                <neptune:nearestTopicName>trident:ChouettePTNetwork/trident:StopArea/trident:StopAreaExtension/trident:nearestTopicName</neptune:nearestTopicName>
                                                <neptune:fareCode>trident:ChouettePTNetwork/trident:StopArea/trident:StopAreaExtension/trident:fareCode</neptune:fareCode>
                                            </neptune:StopAreaExtension>
                                        </neptune:hasStopAreaExtension>
                                    </neptune:StopArea>
                                </neptune:hasStopArea>
                            </xsl:for-each>
                         </neptune:ChouetteArea>
                    </neptune:hasChouetteArea>
               </neptune:ChouettePTNetwork>
        </rdf:RDF>
    </xsl:template>
    </xsl:stylesheet>
    Et lorsque j'utilise xsltproc pour produire le XML voulu, les balises sont vides Et lorsque j'enlève le "for-each" ça marche. J'en déduis donc que c'est mon "select" qui est foireux, mais je n'arrive pas à voir où

    Si un âme charitable pouvais me dire pourquoi ça ne marche pas je lui en serait reconnaissant

    Vous pouvez aller voir mes tutos et mes critiques: ici
    Ainsi que mon: blog

    Je ne répondrai à aucune question technique par MP les forums sont présents pour ça

    c'est très intelligent un ordinateur: "Keyboard ERROR. No keyboard Connected. Press any key to continue..."

  2. #2
    Expert éminent sénior

    Avatar de snake264
    Homme Profil pro
    Datascientist chez Leboncoin
    Inscrit en
    Novembre 2006
    Messages
    2 914
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Datascientist chez Leboncoin
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Novembre 2006
    Messages : 2 914
    Points : 13 312
    Points
    13 312
    Par défaut
    J'ai trouvé mon erreur.

    Merci quand même
    Vous pouvez aller voir mes tutos et mes critiques: ici
    Ainsi que mon: blog

    Je ne répondrai à aucune question technique par MP les forums sont présents pour ça

    c'est très intelligent un ordinateur: "Keyboard ERROR. No keyboard Connected. Press any key to continue..."

  3. #3
    Expert confirmé
    Avatar de Loceka
    Profil pro
    Inscrit en
    Mars 2004
    Messages
    2 276
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2004
    Messages : 2 276
    Points : 4 845
    Points
    4 845
    Par défaut
    Et tu peux faire partager ?

  4. #4
    Expert éminent sénior

    Avatar de snake264
    Homme Profil pro
    Datascientist chez Leboncoin
    Inscrit en
    Novembre 2006
    Messages
    2 914
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Datascientist chez Leboncoin
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Novembre 2006
    Messages : 2 914
    Points : 13 312
    Points
    13 312
    Par défaut
    faute de frappe.
    Vous pouvez aller voir mes tutos et mes critiques: ici
    Ainsi que mon: blog

    Je ne répondrai à aucune question technique par MP les forums sont présents pour ça

    c'est très intelligent un ordinateur: "Keyboard ERROR. No keyboard Connected. Press any key to continue..."

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

Discussions similaires

  1. Afficher des images triées dans un fichier XML avec XSL
    Par lino100 dans le forum XML/XSL et SOAP
    Réponses: 15
    Dernier message: 28/01/2016, 16h12
  2. Requête sur fichier XML avec liaison de données
    Par lpyann dans le forum XML/XSL et SOAP
    Réponses: 8
    Dernier message: 14/08/2014, 21h44
  3. Réponses: 0
    Dernier message: 08/03/2014, 20h19
  4. [Débutante] Extraire des données à partir d'un fichier html avec xsl
    Par sab_etudianteBTS dans le forum XSL/XSLT/XPATH
    Réponses: 3
    Dernier message: 11/03/2008, 09h10
  5. probleme d'affichage de données XML avec XSL
    Par sundjata dans le forum XSL/XSLT/XPATH
    Réponses: 1
    Dernier message: 08/06/2006, 18h59

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