|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: sum of the evaluated values
Or you could even implement "+" on your time type:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:func-transform="f:func-transform"
exclude-result-prefixes="xsl func-transform"
>
<xsl:import href="transform-and-sum.xsl"/>
<xsl:output method="text"/>
<func-transform:func-transform/>
<xsl:template match="/">
<xsl:variable name="sumSeconds">
<xsl:call-template name="transform-and-sum">
<xsl:with-param name="pFuncTransform"
select="document('')/*/func-transform:*[1]"/>
<xsl:with-param name="pList" select="/*/*/@time"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of
select="concat(floor($sumSeconds div 60),
':',
$sumSeconds mod 60
)"/>
</xsl:template>
<xsl:template match="func-transform:*">
<xsl:param name="arg" select="0"/>
<xsl:value-of select="substring-before($arg, ':') * 60
+ substring-after($arg, ':')"/>
</xsl:template>
</xsl:stylesheet>
which when applied on the following xml document:
<events>
<event type="1" time="3:15"/>
<event type="0" time="2:28"/>
<event type="1" time="4:22"/>
<event type="1" time="5:11"/>
</events>
Gives the following result:
15:16
Cheers,
Dimitre Novatchev.
__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








