Problème de XML ET XSL

SSIIS

Nouveau membre
Bonjour,

Je suis débutant en XML

Je dois entrer un fichier,
<?xml version="1.0" encoding="UTF-8"?>
<META xmlns:xs="http://www.w3.org/2001/XMLSchema">


<MOTS_CLES>Mot clé,tt,yy,yyt</MOTS_CLES>


</META>


Avec le template

<?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:general>

<lom:keyword>
<lom:string language="fre">
<xsl:value-of select="META/MOTS_CLES"/>
</lom:string>

</lom:keyword>





</lom:general>
<lom:lifeCycle>

<lom:version>
<lom:string language="fre">
<xsl:value-of select="META/VERSION"/>
</lom:string>
</lom:version>
<lom:status>
<lom:source>LOMv1.0</lom:source>
<lom:value>final</lom:value>
</lom:status>
<lom:contribute>
<lom:role>
<lom:source>LOMv1.0</lom:source>
<lom:value>author</lom:value>
</lom:role>
<lom:entity>
<xsl:value-of select="META/AUTEURS"/>
</lom:entity>
<lom:entity>
<xsl:value-of select="META/AUTEURS"/>
</lom:entity>

<lom:date>
<lom:dateTime>
<xsl:value-of select="META/DATE"/>
</lom:dateTime>
</lom:date>
</lom:contribute>
</lom:lifeCycle>

</lom:lom>

</xsl:template>




<xsl:template match ="/">
<xsl:element name="lom:lom">
<xsl:call-template name="tmpSplitString">



<xsl:with-param name="stringtosplit" select ="META/MOTS_CLES" />
</xsl:call-template>
</xsl:element>
</xsl:template>


<xsl:template name="tmpSplitString">
<xsl:param name="stringtosplit" />
<xsl:variable name="first" select="substring-before($stringtosplit, ',')" />
<xsl:variable name="remaining" select="substring-after($stringtosplit, ',')" />
<xsl:element name ="lom:keyword">
<xsl:value-of select="$first" />
</xsl:element>
<xsl:if test="$remaining">
<xsl:call-template name="tmpSplitString">
<xsl:with-param name="stringtosplit" select="$remaining" />
</xsl:call-template>
</xsl:if>


</xsl:template>



</xsl:stylesheet>


XML généré

<?xml version="1.0"?>
<lom:lom xmlns:lom="http://ltsc.ieee.org/xsd/LOM"><lom:keyword>Mot clé</lom:keyword><lom:keyword>tt</lom:keyword><lom:keyword>yy</lom:keyword><lom:keyword/></lom:lom>

C'est l'exemple que je veux
 

SSIIS

Nouveau membre
Autre pb maintenant

En entrée

<?xml version="1.0" encoding="UTF-8"?>
<META xmlns:xs="http://www.w3.org/2001/XMLSchema">
<AUTEURS>
<AUTEUR>auteur1</AUTEUR>
<AUTEUR>auteur2</AUTEUR>
<PRESENTATION_AUTEUR>Présentation1</PRESENTATION_AUTEUR>
</AUTEURS>
<DESCRIPTION>Description</DESCRIPTION>
<CONSEIL_METHODO_COURS>Conseils méthodologiques</CONSEIL_METHODO_COURS>
<DUREE>Durée</DUREE>
<MOTS_CLES>Mot clé,ll,ml</MOTS_CLES>
<PREREQUIS>Prérequis</PREREQUIS>
<BIBLIOGRAPHIE_COURS>Bibliographie</BIBLIOGRAPHIE_COURS>
<TITRE_RESSOURCE>Titre de la ressource</TITRE_RESSOURCE>
<VALEUR>Valeur d'identification de la ressource</VALEUR>
<VERSION>Version</VERSION>
<DATE>0001-01-01</DATE>
<VALEUR_METADONNEES>Identifiant de la métadonnée</VALEUR_METADONNEES>
<TECHNIQUE_LOCALISATION>Localisation du document à déposer</TECHNIQUE_LOCALISATION>
<DUREE_APPRENTISSAGE>1900-01-01T00:00:00</DUREE_APPRENTISSAGE>
</META>



XSL

<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:general>
<lom:title>
<lom:string language="fre">
<xsl:value-of select="META/TITRE_RESSOURCE"/>
</lom:string>
</lom:title>
<lom:identifier>
<lom:catalog>URI</lom:catalog>
<lom:entry>
<xsl:value-of select="META/VALEUR"/>
</lom:entry>
</lom:identifier>
<lom:language>fre</lom:language>
<lom:description>
<lom:string language="fre">
<xsl:value-of select="META/DESCRIPTION"/>
</lom:string>
</lom:description>
<lomfr:documentType xmlns:lomfr="http://www.lom-fr.fr/xsd/LOMFR">
<lomfr:source>LOMFRv1.0</lomfr:source>
<lomfr:value>ressource interactive</lomfr:value>
</lomfr:documentType>




<lom:keyword>
<lom:string language="fre">
<xsl:value-of select="META/MOTS_CLES"/>
</lom:string>
</lom:keyword>

</lom:general>
<lom:lifeCycle>

<lom:version>
<lom:string language="fre">
<xsl:value-of select="META/VERSION"/>
</lom:string>
</lom:version>
<lom:status>
<lom:source>LOMv1.0</lom:source>
<lom:value>final</lom:value>
</lom:status>
<lom:contribute>
<lom:role>
<lom:source>LOMv1.0</lom:source>
<lom:value>author</lom:value>
</lom:role>
<lom:entity>
<xsl:value-of select="META/AUTEURS"/>
</lom:entity>
<lom:entity>
<xsl:value-of select="META/AUTEURS"/>
</lom:entity>

<lom:date>
<lom:dateTime>
<xsl:value-of select="META/DATE"/>
</lom:dateTime>
</lom:date>
</lom:contribute>
</lom:lifeCycle>
<lom:metaMetadata>
<lom:contribute>
<lom:value>
<xsl:value-of select="META/VALEUR_METADONNEES"/>
</lom:value>
<lom:role>
<lom:source>LOMv1.0</lom:source>
<lom:value>creator</lom:value>
</lom:role>
<lom:entity><xsl:value-of select="META/AUTEURS"/></lom:entity>


<lom:date>
<lom:dateTime>
<xsl:value-of select="META/DATE"/>
</lom:dateTime>
</lom:date>
</lom:contribute>
</lom:metaMetadata>
<lom:technical>
<lom:format>text/css</lom:format>
<lom:format>application/x-shockwave-flash</lom:format>
<lom:format>text/html</lom:format>
<lom:format>application/pdf</lom:format>
<lom:format>application/xml</lom:format>
<lom:format>image/gif</lom:format>
<lom:format>image/jpeg</lom:format>
<lom:format>image/png</lom:format>
<lom:format>video/quicktime</lom:format>
<lom:location>
<xsl:value-of select="META/TECHNIQUE_LOCALISATION"/>
</lom:location>
<lom:requirement>
<lom:orComposite>
<lom:type>
<lom:source>LOMv1.0</lom:source>
<lom:value>browser</lom:value>
</lom:type>
<lom:name>
<lom:source>LOMv1.0</lom:source>
<lom:value>any</lom:value>
</lom:name>
<lom:minimumVersion>"Mozilla Firefox : 2+","Google Chrome : toutes versions","Internet Explorer : 7+","Opera : 9+","Safari : 2+"</lom:minimumVersion>
<lom:maximumVersion>"Mozilla Firefox : 2+","Google Chrome : toutes versions","Internet Explorer : 7+","Opera : 9+","Safari : 2+"</lom:maximumVersion>
</lom:orComposite>
</lom:requirement>
<lom:installationRemarks>
<lom:string language="fre">Lire le fichier "spécification " présent dans chaque leçon.</lom:string>
</lom:installationRemarks>
<lom:otherPlatformRequirements>
<lom:string language="fre">Nécessite "Flash Player", "Quick Time Player", "Acrobat Reader".</lom:string>
</lom:otherPlatformRequirements>
</lom:technical>
<lom:educational>
<lom:interactivityType>
<lom:source>LOMv1.0</lom:source>
<lom:value>mixed</lom:value>
</lom:interactivityType>
<lom:context>
<lom:source>LOMv1.0</lom:source>
<lom:value>higher education</lom:value>
</lom:context>

<lom:interactivityLevel>
<lom:source>LOMv1.0</lom:source>
<lom:value>medium</lom:value>
</lom:interactivityLevel>
<lom:difficulty>
<lom:source>LOMv1.0</lom:source>
<lom:value>medium</lom:value>
</lom:difficulty>
<lom:typicalLearningTime>
<lom:duration>
<xsl:value-of select="META/DUREE_APPRENTISSAGE"/>
</lom:duration>
<lom:description>
<lom:string language="fre">Licence ou M1 ou M2</lom:string>
</lom:description>
<lom:language>fre</lom:language>

</lom:typicalLearningTime>
</lom:educational>
<lom:rights>
<lom:cost>
<lom:source>LOMv1.0</lom:source>
<lom:value>no</lom:value>
</lom:cost>
<lom:copyrightAndOtherRestrictions>
<lom:source>LOMv1.0</lom:source>
<lom:value>yes</lom:value>
</lom:copyrightAndOtherRestrictions>
<lom:description>
<lom:string language="fre">Etre inscrit en Droit dans une université partenaire de l'UNJF</lom:string>
</lom:description>
</lom:rights>
<lom:classification>
<lom:purpose>
<lom:source>LOMv1.0</lom:source>
<lom:value>competency</lom:value>
</lom:purpose>
</lom:classification>
</lom:lom>
</xsl:template>

<xsl:template match = "AUTEUR">
<lom:entity>BEGIN:VCARD
VERSION:3.0
N:<xsl:value-of select="AUTEUR"/>;;;
FN:Nom Entier
EMAIL;TYPE=INTERNET:
ORG:
END:VCARD
</lom:entity>
</xsl:template>


<xsl:template match ="META/MOTS_CLES">
<xsl:element name="META">
<xsl:call-template name="tmpSplitString">



<xsl:with-param name="stringtosplit" select ="META/MOTS_CLES" />
</xsl:call-template>
</xsl:element>
</xsl:template>


<xsl:template name="tmpSplitString">
<xsl:param name="stringtosplit" />
<xsl:variable name="first" select="substring-before($stringtosplit, ',')" />
<xsl:variable name="remaining" select="substring-after($stringtosplit, ',')" />
<xsl:element name ="lom:keyword">
<xsl:value-of select="$first" />
</xsl:element>
<xsl:if test="$remaining">
<xsl:call-template name="tmpSplitString">
<xsl:with-param name="stringtosplit" select="$remaining" />
</xsl:call-template>
</xsl:if>


</xsl:template>




</xsl:stylesheet>



Résultat généré( pour keyword)

<lom:keyword><lom:string language="fre">Mot clé,ll,ml</lom:string></lom:keyword>

qqn voit où est l'erreur SVP?

Merci





 

zeb

Modérateur
Salut, et bienvenu

Tu es débutant en forum, aussi :o
Merci de commencer toute pièce de code par [code] et la finir par [/code].
Pour éditer ton message, c'est un des deux boutons représentant un crayon en bas de chaque message.
 
Vous devez vous inscrire ou vous connecter pour répondre ici.
Derniers messages publiés
Statistiques globales
Discussions
730 132
Messages
6 718 035
Membres
1 586 389
Dernier membre
ROCKET8
Partager cette page
Haut