[XSLT]Problème avec un if
J'ai ce fichier XML en entrée :
Code:
1 2 3 4 5 6 7 8
|
<?xml version="1.0" encoding="UTF-8"?>
<PKT>
<DesCliBlNbr> 1234567</DesCliBlNbr>
<DateRecepEDI>20060717</DateRecepEDI>
<ManagingTerritory>LIF</ManagingTerritory>
<ShipToCnty>101720</ShipToCnty>
</PKT> |
Je veux faire une transformation XSL et faire un test sur la balise ManagingTerritory pour appliquer la transformation seulement si cette balise prend la valeur LIF ou TID ou LIF. J'ai essayé ceci mais ça ne marche pas :
Code:
1 2 3 4 5 6 7 8 9 10 11
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes">
<xsl:import href="communs.xsl"/>
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:variable name="wManagingTerritory" select="/PKT/ManagingTerritory/node()"/>
<xsl:if test="$wManagingTerritory = 'TID' or $wManagingTerritory = LIF or $wManagingTerritory = LIV">MT :<xsl:value-of select="$wManagingTerritory"/>
</xsl:if>
</xsl:template>
</xsl:stylesheet> |
Merci de m'aider.