XSL : how using sum with a comma delimited list

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ouioui

    XSL : how using sum with a comma delimited list

    Hi,

    I need to use the xsl sum function like that :

    <xsl:value-of select="sum(Com pteRendu/Compte/@number)" />

    My xml source contains number with comma like that :

    <Compte number=447,68" />
    <Compte number="11904,6 6" />

    How can i use the sum function with a comma delimited list?
  • Mukul Gandhi

    #2
    Re: XSL : how using sum with a comma delimited list

    Please try this XSL...

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:styleshe et version="1.0"
    xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
    xmlns:xalan="ht tp://xml.apache.org/xalan">

    <xsl:output method="text" />

    <xsl:template match="/">
    <xsl:variable name="rtf">
    <xsl:for-each select="CompteR endu/Compte/@number">
    <num>
    <xsl:value-of select="transla te(.,',','')" />
    </num>
    </xsl:for-each>
    </xsl:variable>
    <xsl:value-of select="sum(xal an:nodeset($rtf )/num)" />
    </xsl:template>

    </xsl:stylesheet>

    The above XSL uses nodeset extension function...

    Regards,
    Mukul

    bruno.barthez@a nova.fr (ouioui) wrote in message news:<55360399. 0409210555.6faf 063a@posting.go ogle.com>...[color=blue]
    > Hi,
    >
    > I need to use the xsl sum function like that :
    >
    > <xsl:value-of select="sum(Com pteRendu/Compte/@number)" />
    >
    > My xml source contains number with comma like that :
    >
    > <Compte number=447,68" />
    > <Compte number="11904,6 6" />
    >
    > How can i use the sum function with a comma delimited list?[/color]

    Comment

    Working...