Project

Profile

Help

Bug #4738 » test.xslt

Marek Skorek, 2020-09-15 15:20

 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xsl:output method="xml" encoding="UTF-8" />

<xsl:template match="/">
<message>
<xsl:call-template name="Cus" />
</message>
</xsl:template>

<xsl:template name="Cus">
<xsl:for-each select="root/Cus">
<xsl:element name="client">
<merchant-limit due-limit="{@TradeCredit}" days-limit="{@DaysDelay}">
<xsl:choose>
<xsl:when test="@SaleLock = 0">
<xsl:attribute name="block-strategy" select="'A'" />
</xsl:when>
<xsl:when test="@SaleLock = 1">
<xsl:attribute name="block-strategy" select="'B'" />
</xsl:when>
<xsl:when test="@SaleLock = 2">
<xsl:attribute name="block-strategy" select="'C'" />
</xsl:when>
<xsl:when test="@SaleLock = 3">
<xsl:attribute name="block-strategy" select="'D'" />
</xsl:when>
<xsl:when test="@SaleLock = 4">
<xsl:attribute name="block-strategy" select="'E'" />
</xsl:when>
<xsl:when test="@SaleLock = 5">
<xsl:attribute name="block-strategy" select="'F'" />
</xsl:when>
</xsl:choose>
</merchant-limit>

</xsl:element>

</xsl:for-each>
</xsl:template>

</xsl:stylesheet>
(4-4/4)