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

AW: [xsl] sum of duration as string

Subject: AW: [xsl] sum of duration as string
From: "Dr. Patrik Stellmann patrik.stellmann@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 9 Mar 2016 15:26:02 -0000

Something like this should work:

<xsl:value-of select="sum(for $i in tokenize(., ',')[(position() mod 2) = 1]
return xs:dayTimeDuration($i))"/>


Systemarchitektur & IT-Projekte
Tel: +49 40 33449-1142
Fax: +49 40 33449-1400
E-Mail: Patrik.Stellmann@xxxxxxxxx<mailto:Patrik.Stellmann@xxxxxxxxx>

Von: cmarchand@xxxxxxxxxx [mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx]
Gesendet: Mittwoch, 9. MC$rz 2016 15:42
An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Betreff: [xsl] sum of duration as string


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
Emplacement de dC)but: 245:0
URL: http://www.w3.org/TR/xpath20/#ERRXPTY0004

I use /xsl:stylesheet/@version="2.0" with Saxon-PE

Any help will be much appreciated.

XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe<-list/2718916> (by email<>)
GDV Dienstleistungs-GmbH & Co. KG
GlockengieCerwall 1
D-20095 Hamburg

Sitz und Registergericht: Hamburg
HRA 93 894
USt.-IdNr : DE 205183123

GDV Beteiligungsgesellschaft mbH
Sitz und Registergericht: Hamburg
HRB 71 153

Dr. Jens Bartenwerfer
Michael Bathke
Volker Sonnenburg

Diese E-Mail und alle AnhC$nge enthalten vertrauliche und/oder rechtlich
geschC<tzte Informationen. Wenn Sie nicht der richtige Adressat sind oder
diese E-Mail irrtC<mlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die
unbefugte Weitergabe der E-Mail ist nicht gestattet.

This e-mail and any attached files may contain confidential and/or privileged
information. If you are not the intended recipient (or have received this
e-mail in error) please notify the sender immediately and destroy this e-mail.
Any unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.

Current Thread