[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] sum of duration as string

Subject: Re: [xsl] sum of duration as string
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 9 Mar 2016 15:10:55 -0000

cmarchand@xxxxxxxxxx wrote:

I have a comma separated string of durations :


I want to calculate the sum of the durations who are in odd positions.

I've tried this :

<xsl:function name="local:sumDuration" as="xs:duration">
    <xsl:param name="seq" as="xs:string+"/>
       <xsl:when test="count($seq) ge 3">
          <xsl:variable name="dur1" as="xs:duration"
          <xsl:value-of select="$dur1 +
          <xsl:value-of select="xs:duration($seq[1])"/>


<xsl:value-of select="local:sumDuration(tokenize(./text(),','))"/>

I get this error :

ID SystC(me:
ScC)nario: makeTable
fichier XSL:
Nom du moteur: Saxon-PE
GravitC): fatal
Description: XPTY0004: Only subtypes of xs:duration can be added

Try to use xs:dayTimeDuration($seq[1]) instead of xs:duration.

And consider to use `xsl:sequence` instead of `xsl:value-of`.

Current Thread