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

XML/XSL et SOAP Discussion :

Demande d'un conseil technique


Sujet :

XML/XSL et SOAP

  1. #1
    Nouveau Candidat au Club
    Homme Profil pro
    Inscrit en
    Juillet 2013
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2013
    Messages : 6
    Points : 1
    Points
    1
    Par défaut Demande d'un conseil technique
    Bonjour,

    je voudrais demander conseil pour le format Vcard, je m'explique.

    dans mon fichier XML en entrée
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    <?xml version="1.0" encoding="UTF-8"?>
    <META xmlns:xs="http://www.w3.org/2001/XMLSchema">       
     
    <AUTEURS>		
    			<AUTEUR>auteur1</AUTEUR>
    			<AUTEUR>auteur2</AUTEUR>
    		</AUTEURS>	
    </META>


    Concernant le XSl, le voici

    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
     
     
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:lom="http://ltsc.ieee.org/xsd/LOM" xmlns:lomfr="http://www.lom-fr.fr/xsd/LOMFR" 
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ltsc.ieee.org/xsd/LOM http://ltsc.ieee.org/xsd/lomv1.0/lom.xsd">
     
    <xsl:template match = "/">(il y a d'autres champs, mais on se concentre uniquement sur auteurs)
    		<lom:lom> 
     
    	<lom:lifeCycle>
     
    <lom:contribute>
    <lom:entity>BEGIN:VCARD
    VERSION:3.0
    N:<xsl:value-of select="META/AUTEURS"/>;;;
    FN:
    EMAIL;TYPE=INTERNET:
    ORG:
    END:VCARD</lom:entity>
     
    </lom:contribute>
     
    	</lom:lifeCycle>
     
    </lom:lom>








    Pour le XML en sortie, je désirerai le résultat suivant :

    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
    <?xml version="1.0"?>
    <lom:lom xmlns:lom="http://ltsc.ieee.org/xsd/LOM" xmlns:lomfr="http://www.lom-fr.fr/xsd/LOMFR" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     
    <lom:lifeCycle>
     
    		<lom:contribute>
    			<lom:role>
    				<lom:source>LOMv1.0</lom:source>
    				<lom:value>author</lom:value>
    			</lom:role>
    			<lom:entity>
    BEGIN:VCARD
    VERSION:3.0
    N:
    auteur1
    ;;;
    FN:
    EMAIL;TYPE=INTERNET:
    ORG:
    END:VCARD
    </lom:entity>
     
    		<lom:entity>
    BEGIN:VCARD
    VERSION:3.0
    N:
    auteur2
    ;;;
    FN:
    EMAIL;TYPE=INTERNET:
    ORG:
    END:VCARD
    </lom:entity>
     
    		</lom:contribute>
     
    </lom:lifeCycle>
     
    </lom:lom>
    	</xsl:template>
     
     
    <xsl:template match = "AUTEURS">
    	           <lom:entity>BEGIN:VCARD
    VERSION:3.0
    N:<xsl:value-of select="META/AUTEUR"/>;;;
    FN:
    EMAIL;TYPE=INTERNET:
    ORG:
    END:VCARD
     
    </lom:entity>
    	</xsl:template>
     
    </xsl:stylesheet>


    Donc avec le fichier XML et la XSL, on obtient le fiichier de sortie que l'on passe au formulaire ORI-OAI.

    Alors, quand je fais appliquer, il y a les 2 auteurs affichés dans entity sur la même ligne.
    J'aimerais faire afficher Auteur 1
    et Auteur 2 distinctement.

    j'hésite entre un split et un for each

    http://demo.ori-oai.org/md-editor/fr...r-sup-full/new (y regarder l'onglet cycle de vie de même que metadonnées)

    Merci, Bonne journée

    Nimar

  2. #2
    Modérateur

    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    12 551
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 12 551
    Points : 21 607
    Points
    21 607
    Par défaut
    Citation Envoyé par Nimar15 Voir le message
    j'hésite entre un split et un for each
    for-each. Plusieurs éléments <AUTEUR> et on veut créer un truc pour chacun d'eux. C'est le principe du for-each.

    Le split() c'est quand on est pas organisés en éléments et qu'on doit traiter du texte brut.
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  3. #3
    Nouveau Candidat au Club
    Homme Profil pro
    Inscrit en
    Juillet 2013
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2013
    Messages : 6
    Points : 1
    Points
    1
    Par défaut
    Citation Envoyé par thelvin Voir le message
    for-each. Plusieurs éléments <AUTEUR> et on veut créer un truc pour chacun d'eux. C'est le principe du for-each.

    Le split() c'est quand on est pas organisés en éléments et qu'on doit traiter du texte brut.
    Oui, merci.

  4. #4
    Nouveau Candidat au Club
    Homme Profil pro
    Inscrit en
    Juillet 2013
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2013
    Messages : 6
    Points : 1
    Points
    1
    Par défaut
    Re,

    alors, en essayant le-for each avec un auteur, ça marche ss pb.
    Là où cela se gate, c'est en ajoutant "Auteur2". Du coup Auteur 2 et auteur 1 s'affichent ensemble

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    <?xml version="1.0" encoding="UTF-8"?>
    <META xmlns:xs="http://www.w3.org/2001/XMLSchema">          	 
    		<AUTEURS>		
    			<AUTEUR>auteur1</AUTEUR>
     
    </AUTEURS>	
     
    </META>


    le 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
    37
    38
    39
    40
    41
    42
    43
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:lom="http://ltsc.ieee.org/xsd/LOM" xmlns:lomfr="http://www.lom-fr.fr/xsd/LOMFR" 
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ltsc.ieee.org/xsd/LOM http://ltsc.ieee.org/xsd/lomv1.0/lom.xsd">
    	<xsl:template match = "/">
    		<lom:lom>  
     
    <lom:lifeCycle> 
     
    <lom:contribute>
    <lom:entity>BEGIN:VCARD
    VERSION:3.0
    N:<xsl:apply-templates/>;;;
    FN:
    EMAIL;TYPE=INTERNET:
    ORG:
    END:VCARD</lom:entity>
     
     
     
     
    	</lom:contribute>
    			</lom:lifeCycle>
    </lom:lom>
     
     
    	</xsl:template>
     
          <xsl:template match="META/AUTEUR/AUTEUR">
     
     
    	           <lom:entity>BEGIN:VCARD
    VERSION:3.0
    N: <xsl:apply-templates/>
        ;;;
    FN:
    EMAIL;TYPE=INTERNET:
    ORG:
    END:VCARD
     
    </lom:entity>
     </xsl:template>	
    </xsl:stylesheet>

    le xml de sortie

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    <?xml version="1.0"?>
    <lom:lom xmlns:lom="http://ltsc.ieee.org/xsd/LOM" xmlns:lomfr="http://www.lom-fr.fr/xsd/LOMFR" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><lom:lifeCycle><lom:contribute><lom:entity>BEGIN:VCARD
    VERSION:3.0
    N:
    auteur1
    ;;;
    FN:
    EMAIL;TYPE=INTERNET:
    ORG:
    END:VCARD</lom:entity></lom:contribute></lom:lifeCycle></lom:lom>
    avec une occurence auteur, zéro pb
    mais avec une occurence auteur en plus dans le fichier xml en entrée, on a ça:


    <lom:entity>BEGIN:VCARD
    VERSION:3.0
    N:
    auteur1
    auteur2
    ;;;
    FN:
    EMAIL;TYPE=INTERNET:
    ORG:
    END:VCARD</lom:entity></lom:contribute></lom:lifeCycle></lom:lom>
    [/CODE]

  5. #5
    Nouveau Candidat au Club
    Homme Profil pro
    Inscrit en
    Juillet 2013
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2013
    Messages : 6
    Points : 1
    Points
    1
    Par défaut Rectificatif
    J'ai pas fait attention en prenant le code de la xsl, dsl

    Il n y a pas de for each dans celui la

    la par contre il y en a un


    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
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:lom="http://ltsc.ieee.org/xsd/LOM" xmlns:lomfr="http://www.lom-fr.fr/xsd/LOMFR" 
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ltsc.ieee.org/xsd/LOM http://ltsc.ieee.org/xsd/lomv1.0/lom.xsd">
    	<xsl:template match = "/">
    		<lom:lom>  
     
    <lom:lifeCycle> 
     
    <lom:contribute>
    <lom:entity>BEGIN:VCARD
    VERSION:3.0
    N:<xsl:value-of select="META/AUTEURS/AUTEUR"/>;;;
    FN:
    EMAIL;TYPE=INTERNET:
    ORG:
    END:VCARD</lom:entity>
     
     
    	</lom:contribute>
    			</lom:lifeCycle>
    </lom:lom>
     
     
    	</xsl:template>
     
     
     
     
     
          <xsl:template match="META/AUTEUR/AUTEUR">
     
     
    	           <lom:entity>BEGIN:VCARD
    VERSION:3.0
    N: <xsl:for-each select="AUTEUR">
          <xsl:value-of select="AUTEUR"/>
        </xsl:for-each>
        ;;;
    FN:
    EMAIL;TYPE=INTERNET:
    ORG:
    END:VCARD
     
    </lom:entity>
     </xsl:template>	
    </xsl:stylesheet>

    en sortie

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    <?xml version="1.0"?>
    <lom:lom xmlns:lom="http://ltsc.ieee.org/xsd/LOM" xmlns:lomfr="http://www.lom-fr.fr/xsd/LOMFR" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><lom:lifeCycle><lom:contribute><lom:entity>BEGIN:VCARD
    VERSION:3.0
    N:auteur1;;;
    FN:
    EMAIL;TYPE=INTERNET:
    ORG:
    END:VCARD</lom:entity></lom:contribute></lom:lifeCycle></lom:lom>

  6. #6
    Modérateur

    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    12 551
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 12 551
    Points : 21 607
    Points
    21 607
    Par défaut
    Tu veux une VCard par <AUTEUR>, mais ton for-each ne contient pas la VCARD.
    Il est évident que le for-each doit contenir la VCARD.
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  7. #7
    Nouveau Candidat au Club
    Homme Profil pro
    Inscrit en
    Juillet 2013
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2013
    Messages : 6
    Points : 1
    Points
    1
    Par défaut
    Cela-dit, faut-il une variable spécifique pour la vcard ou le fait d'imbriquer permet de créer une vcard par auteur?

  8. #8
    Nouveau Candidat au Club
    Homme Profil pro
    Inscrit en
    Juillet 2013
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2013
    Messages : 6
    Points : 1
    Points
    1
    Par défaut
    ou alors exporter les contacts et éditer un fichier dans un éditeur de texte?

  9. #9
    Modérateur

    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    12 551
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 12 551
    Points : 21 607
    Points
    21 607
    Par défaut
    Citation Envoyé par Nimar15 Voir le message
    Cela-dit, faut-il une variable spécifique pour la vcard ou le fait d'imbriquer permet de créer une vcard par auteur?
    Et si tu essayais ?
    Pourrais-tu je te prie, commencer par apprendre XSLT, avec des tutoriels ou un bouquin, puis ensuite essayer de faire ton truc avec ?

    Citation Envoyé par Nimar15 Voir le message
    ou alors exporter les contacts et éditer un fichier dans un éditeur de texte?
    Je ne comprends pas en quoi ça t'aiderait.
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

Discussions similaires

  1. [CV] Demande d'avis, conseils
    Par Dia_FR dans le forum CV
    Réponses: 7
    Dernier message: 25/01/2017, 19h28
  2. Demande de vos conseils et avis, merci.
    Par Invité dans le forum Emploi
    Réponses: 2
    Dernier message: 02/12/2008, 09h35
  3. Demande d'un conseil
    Par kam81 dans le forum Servlets/JSP
    Réponses: 2
    Dernier message: 03/08/2008, 15h54
  4. Petit conseil technique
    Par Panaméen dans le forum C++Builder
    Réponses: 12
    Dernier message: 18/05/2008, 20h38
  5. Réponses: 2
    Dernier message: 07/05/2008, 23h57

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