Subject: RE: casting sequences
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 7 Jan 2009 22:44:32 -0000
|
for $t in tokenize() return xs:dayTimeDuration($t)
Tedious - some of us tried very hard to get a "simple mapping operator" that
would do this without needing a variable - but the attempt floundered.
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: Henry S. Thompson [mailto:ht@xxxxxxxxxxxx]
> Sent: 07 January 2009 15:46
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: casting sequences
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I have input like this:
>
> . . .
> <topics days="P1D P4D">
> . . .
>
> and in order to get a sequence of dayTimeDurations, which is
> what I want, I've had to write
>
> <xsl:variable name="days" select="tokenize(//topics/@days,' ')"/>
> <xsl:variable name="ds"
>
> select="(xs:dayTimeDuration($days[1]),xs:dayTimeDuration($days[2]))"/>
>
> This is not only tedious, it only works if I know in advance
> how many days there will be, which in principle I don't.
> What's the right way to do this? I spent rather a long time
> searching the documentation without success. . .
>
> ht
> - --
> Henry S. Thompson, School of Informatics, University
> of Edinburgh
> Half-time member of W3C Team
> 10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND -- (44)
> 131 650-4440
> Fax: (44) 131 651-1426, e-mail: ht@xxxxxxxxxxxx
> URL: http://www.ltg.ed.ac.uk/~ht/
> [mail really from me _always_ has this .sig -- mail without
> it is forged spam] -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.6 (GNU/Linux)
>
> iD8DBQFJZM5JkjnJixAXWBoRAvFQAJ42q/gItDozDIIzjyMTkF9wm5fChACeJFHj
> /pMc5wWWsGXOmRJO74ROgsg=
> =Krd7
> -----END PGP SIGNATURE-----
|