1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| <xsl:template match="constitution/options/" mode="somme-options">
<row>
<col width="140" class="tableLabel" >Options</col>
<col width="380" class="evenLineL">Sous-total</col>
<col width="100%" class="evenLineL">
<xsl:variable name="total_compte">
<xsl:call-template name="somme">
<xsl:with-param name="noeuds" select="option"/>
<xsl:with-param name="attribut" select="option/prix"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="translate($total_compte, '.', ',')"/>
</col>
</row>
</xsl:template>
<xsl:template name="somme">
<xsl:param name="total" select="0"/>
<xsl:param name="noeuds"/>
<xsl:param name="attribut"/>
<xsl:choose>
<xsl:when test="$noeuds">
<xsl:call-template name="somme">
<xsl:with-param name="total" select="$total + number(translate(translate(($noeuds[1]/@*[name()=$attribut], ',', '.'),' ',''))"/>
<xsl:with-param name="noeuds" select="$noeuds/following-sibling::*[1]"/>
<xsl:with-param name="attribut" select="$attribut"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$total"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template> |
Partager