transformation xml-xml

antisavicarth <[email protected]>
Newsgroups gmane.text.xml.french.tech
Message-ID <op.s7m8e0a52vpi9r@bureau>
Voici le fichier de départ : SAPinput2.xml
<?xml version="1.0" encoding="UTF-16"?>
<SAP xsi:noNamespaceSchemaLocation="SAP.xsd"  
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ficheInformation>
<fiche>
<document>
<NE/>
</document>
</fiche>
<fiche>
<document>
<NE/>
</document>
</fiche>
<fiche>
<document>
<IM/>
</document>
</fiche>
<fiche>
<document>
<DS/>
</document>
</fiche>
</ficheInformation>
</SAP>

Je veux le transformer en utilisant XSLT pour obtenir en sortie le fichier  
suivant : SAPoutputModel2.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<Information>
<ficheInfo>
<doc>Interne</doc>
</ficheInfo>
<ficheInfo>
<doc>Interne</doc>
</ficheInfo>
<ficheInfo>
<doc>Externe</doc>
</ficheInfo>
<ficheInfo>
<doc>Interne</doc>
</ficheInfo>
</Information>

Voici le fichier de transformation : SAP02.xsl
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"  
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--modification de encoding-->
<xsl:output method="xml" encoding="ISO-8859-1" indent="yes"/>
<xsl:template match="/SAP">
<xsl:for-each select="ficheInformation">
<Information>
<xsl:for-each select="fiche">
<ficheInfo>
<doc>
<xsl:apply-templates select="document"/>
</doc>
</ficheInfo>
</xsl:for-each>
</Information>
</xsl:for-each>
</xsl:template>
<xsl:template match="document">
<xsl:for-each select="descendant::*">
<xsl:copy-of select="local-name()"/>
<!--c'est là que je devrais opérer la sélection:
si enfants de <document> = NE ou DS alors renvoyer Interne en sortie
si enfants de <document> = IM alors renvoyer Externe en sortie-->
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>


Voici ce que SAP02.xsl me retourne en output : SAPoutput02.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<Information>
<ficheInfo>
<doc>NE</doc>
</ficheInfo>
<ficheInfo>
<doc>NE</doc>
</ficheInfo>
<ficheInfo>
<doc>IM</doc>
</ficheInfo>
<ficheInfo>
<doc>DS</doc>
</ficheInfo>
</Information>

Je n'arrive pas à faire le changement de valeur en sortie selon la  
condition commentée dans le fichier SAP02.xsl
Merci de venir à mon aide.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.