From: Testud David (david.testud@ledl.com)
Date: 02/09/2003 - 10:51
Merci pour votre aide si approfondie. En effet cette méthode fonctionne mais
seulement si je n'ai pas d'élément <BR/> dans blah..blah...blah...
Si j'ai :
<TITRE>Titre1</TITRE>blah...blah...<BR/>blah...
Je n'arrive à avoir que :
<TITRE>Titre1</Titre>
<ARTICLE>blah...blah...</ARTICLE>
<BR/>
<ARTICLE>blah...</ARTICLE>
au lieu de :
<TITRE>Titre1</Titre>
<ARTICLE>blah...blah...<BR/>blah...</ARTICLE>
Pierre a évoqué ce problème avec :
PARTIE
apply-templates TITRE[1]
TITRE
<article>
<copy>
apply-templates
</copy>
<apply-templates following-sibling::*[local-name!='TITRE']
</article>
apply-templates following-sibling::*TITRE[1]
Mais je ne parviens pas à le faire fonctionner...
@+
David
->->-> -----Message d'origine-----
->->-> De : gilles g [mailto:gg.gilles@freesurf.fr]
->->-> Envoyé : mardi 2 septembre 2003 12:31
->->-> À : xml-tech@xmlfr.org
->->-> Objet : [xml-tech] Re: XPath, quand tu nous prends !
->->->
->->->
->->->
->->->
->->-> XSL:
->->->
->->-> <?xml version="1.0" encoding="ISO-8859-1"?>
->->-> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
->->-> xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0">
->->-> <xsl:output method="xml" encoding="ISO-8859-1"/>
->->->
->->-> <xsl:template match="PARTIE">
->->-> <PARTIE>
->->-> <xsl:apply-templates/>
->->-> </PARTIE>
->->-> </xsl:template>
->->->
->->-> <xsl:template match="text()">
->->-> <ARTICLE><xsl:value-of select="."/></ARTICLE>
->->-> </xsl:template>
->->->
->->-> <xsl:template match="TITRE">
->->-> <TITRE><xsl:value-of select="."/></TITRE>
->->-> </xsl:template>
->->->
->->-> <xsl:template match="@*"/>
->->->
->->-> </xsl:stylesheet>
->->-> _________________________________
->->-> XML (tout sur une seule ligne):
->->->
->->-> <?xml version="1.0" encoding="ISO-8859-1"?><PARTIE><TITRE>Titre
->->-> 1</TITRE><TITRE>Titre
->->-> 2</TITRE>blah2...blah2...blah2...<TITRE>Titre
->->-> 3</TITRE>blah3...blah3...blah3...</PARTIE>
->->-> ____________________________
->->-> resultat :
->->->
->->-> <?xml version="1.0" encoding="ISO-8859-1" ?>
->->-> <PARTIE xmlns:xlink="http://www.w3.org/1999/xlink">
->->-> <TITRE>Titre 1</TITRE>
->->-> <TITRE>Titre 2</TITRE>
->->-> <ARTICLE>blah2...blah2...blah2...</ARTICLE>
->->-> <TITRE>Titre 3</TITRE>
->->-> <ARTICLE>blah3...blah3...blah3...</ARTICLE>
->->-> </PARTIE>
->->->
->->-> normalement.... c bon.
->->->
->->-> gilles
->->->
->->-> -----Message d'origine-----
->->-> De : xml-tech-bounce@xmlfr.org
->->-> [mailto:xml-tech-bounce@xmlfr.org]De la
->->-> part de Testud David
->->-> Envoyé : lundi 1 septembre 2003 18:01
->->-> À : 'xml-tech@xmlfr.org'
->->-> Objet : [xml-tech] XPath, quand tu nous prends !
->->->
->->->
->->->
->->-> Bonjour à tous,
->->->
->->-> Soit le xml suivant :
->->-> *********************
->->-> <PARTIE>
->->-> <TITRE>Titre 1</TITRE>
->->-> blah1...blah1...blah1...
->->-> <TITRE>Titre 2</TITRE>
->->-> blah2...blah2...blah2...
->->-> <TITRE>Titre 3</TITRE>
->->-> blah3...blah3...blah3...
->->-> </PARTIE>
->->->
->->-> Je voudrais le transformer via une xslt en :
->->-> ********************************************
->->-> <PARTIE>
->->-> <TITRE>Titre 1</TITRE>
->->-> <ARTICLE>blah1...blah1...blah1...</ARTICLE>
->->-> <TITRE>Titre 2</TITRE>
->->-> <ARTICLE>blah2...blah2...blah2...</ARTICLE>
->->-> <TITRE>Titre 3</TITRE>
->->-> <ARTICLE>blah3...blah3...blah3...</ARTICLE>
->->-> </PARTIE>
->->->
->->-> Voilà quelques heures que je me casse la tête avec XPath
->->-> alors n'auriez vous
->->-> pas un petit coup de pouce à me donner ? J'ai cru un
->->-> instant que c'était
->->-> simple à faire...
->->-> ;o)
->->-> Merci pour votre aide...
->->->
->->-> Cordialement,
->->->
->->-> David
->->->
->->-> ->->-> -----Message d'origine-----
->->-> ->->-> De : Joël Martin-Gallausiaux
->->-> ->->-> [mailto:joel.martin-gallausiaux@sun.com]
->->-> ->->-> Envoyé : vendredi 29 août 2003 15:27
->->-> ->->-> À : xml-tech@xmlfr.org
->->-> ->->-> Objet : [xml-tech] Re: Echantilloner un fichier XML
->->-> ->->->
->->-> ->->->
->->-> ->->->
->->-> ->->->
->->-> ->->-> --
->->-> ->->-> Bonjour,
->->-> ->->->
->->-> ->->-> Oui, on peut le faire avec la plupart des processeur
->->-> ->->-> XSLT (saxon, xalan
->->-> ->->-> ..). en utilisant une extension spécifique. Cette
->->-> ->->-> fonctionnalité est
->->-> ->->-> normalisée en XSLT 2.0. Sinon c'est très facile avec JAXP.
->->-> ->->->
->->-> ->->-> Salutations,
->->-> ->->-> --
->->-> ->->-> Joël Martin-Gallausiaux, Sun Microsystems Educational
->->-> ->->-> Services, France.
->->-> ->->-> Tel : 33 1 4143 1724 Mobile : 33 6 7468 8206
->->-> ->->-> Oui, on peut le faire avec la plupart des processeur
->->-> ->->-> XSLT (saxon, xalan
->->-> ->->-> ..) en utilisant une extension normalisée en XSLT 2.0.
->->-> ->->->
->->-> ->->-> Testud David wrote:
->->-> ->->->
->->-> ->->-> >Bonjour à tous,
->->-> ->->-> >
->->-> ->->-> >J'ai une fichier XML du genre :
->->-> ->->-> ><CHEMINFER>
->->-> ->->-> > <EDT num="1">
->->-> ->->-> > <CAH>...</CAH>
->->-> ->->-> > </EDT>
->->-> ->->-> > <EDT num="2">
->->-> ->->-> > <CAH>...</CAH>
->->-> ->->-> > </EDT>
->->-> ->->-> > <EDT num="3">
->->-> ->->-> > <CAH>...</CAH>
->->-> ->->-> > </EDT>
->->-> ->->-> ></CHEMINFER>
->->-> ->->-> >
->->-> ->->-> >Je souhaiterais échantilloner ce fichier XML en auttant
->->-> ->->-> de petits fichiers
->->-> ->->-> >xml que de balises <EDT> présentes dans mon fichier de
->->-> ->->-> départ. Pour cela,
->->-> ->->-> >existe-t-il un moyen via une XSLT ou dois-je passer par
->->-> ->->-> JAXP par exemple ?
->->-> ->->-> >
->->-> ->->-> >Merci de vos réponses,
->->-> ->->-> >Cordialement,
->->-> ->->-> >David
->->-> ->->-> >--
->->-> ->->-> >Devenez redacteur <XML>fr et contribuez au
->->-> developpement du
->->-> ->->-> >xml francophone (http://xmlfr.org/infos/redacteurs/) !
->->-> ->->-> >
->->-> ->->-> >Liste de diffusion "xml-tech@xmlfr.org"
->->-> (http://xmlfr.org).
->->-> ->->-> >
->->-> ->->-> >Cette liste est a votre disposition pour discuter en
->->-> ->->-> francais de
->->-> ->->-> >tout sujet technique lie a XML.
->->-> ->->-> >
->->-> ->->-> >Pour resilier votre abonnement, envoyez un
->->-> message contenant
->->-> ->->-> >la commande "unsubscribe" a xml-tech-request@xmlfr.org
->->-> ->->-> >(mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
->->-> ->->-> >
->->-> ->->-> >
->->-> ->->-> >
->->-> ->->->
->->-> ->->->
->->-> ->->-> --
->->-> ->->-> Devenez redacteur <XML>fr et contribuez au
->->-> developpement du
->->-> ->->-> xml francophone (http://xmlfr.org/infos/redacteurs/) !
->->-> ->->->
->->-> ->->-> Liste de diffusion "xml-tech@xmlfr.org"
->->-> (http://xmlfr.org).
->->-> ->->->
->->-> ->->-> Cette liste est a votre disposition pour discuter
->->-> en francais de
->->-> ->->-> tout sujet technique lie a XML.
->->-> ->->->
->->-> ->->-> Pour resilier votre abonnement, envoyez un
->->-> message contenant
->->-> ->->-> la commande "unsubscribe" a xml-tech-request@xmlfr.org
->->-> ->->-> (mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
->->-> ->->->
->->-> --
->->-> Devenez redacteur <XML>fr et contribuez au developpement du
->->-> xml francophone (http://xmlfr.org/infos/redacteurs/) !
->->->
->->-> Liste de diffusion "xml-tech@xmlfr.org" (http://xmlfr.org).
->->->
->->-> Cette liste est a votre disposition pour discuter en francais de
->->-> tout sujet technique lie a XML.
->->->
->->-> Pour resilier votre abonnement, envoyez un message contenant
->->-> la commande "unsubscribe" a xml-tech-request@xmlfr.org
->->-> (mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
->->->
->->-> --
->->-> Devenez redacteur <XML>fr et contribuez au developpement du
->->-> xml francophone (http://xmlfr.org/infos/redacteurs/) !
->->->
->->-> Liste de diffusion "xml-tech@xmlfr.org" (http://xmlfr.org).
->->->
->->-> Cette liste est a votre disposition pour discuter en francais de
->->-> tout sujet technique lie a XML.
->->->
->->-> Pour resilier votre abonnement, envoyez un message contenant
->->-> la commande "unsubscribe" a xml-tech-request@xmlfr.org
->->-> (mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
->->->
->->-> --
->->-> Devenez redacteur <XML>fr et contribuez au developpement du
->->-> xml francophone (http://xmlfr.org/infos/redacteurs/) !
->->->
->->-> Liste de diffusion "xml-tech@xmlfr.org" (http://xmlfr.org).
->->->
->->-> Cette liste est a votre disposition pour discuter en francais de
->->-> tout sujet technique lie a XML.
->->->
->->-> Pour resilier votre abonnement, envoyez un message contenant
->->-> la commande "unsubscribe" a xml-tech-request@xmlfr.org
->->-> (mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
->->->
->->-> --
->->-> Devenez redacteur <XML>fr et contribuez au developpement du
->->-> xml francophone (http://xmlfr.org/infos/redacteurs/) !
->->->
->->-> Liste de diffusion "xml-tech@xmlfr.org" (http://xmlfr.org).
->->->
->->-> Cette liste est a votre disposition pour discuter en francais de
->->-> tout sujet technique lie a XML.
->->->
->->-> Pour resilier votre abonnement, envoyez un message contenant
->->-> la commande "unsubscribe" a xml-tech-request@xmlfr.org
->->-> (mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
->->->
--
Devenez redacteur <XML>fr et contribuez au developpement du
xml francophone (http://xmlfr.org/infos/redacteurs/) !
Liste de diffusion "xml-tech@xmlfr.org" (http://xmlfr.org).
Cette liste est a votre disposition pour discuter en francais de
tout sujet technique lie a XML.
Pour resilier votre abonnement, envoyez un message contenant
la commande "unsubscribe" a xml-tech-request@xmlfr.org
(mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
Archive générée par hypermail 2.1.3 le 28/06/2004 - 11:06 UTC
webmaster@xmlfr.org
|