[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: casting sequences

Subject: RE: casting sequences
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 7 Jan 2009 22:44:32 -0000
RE:  casting sequences
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-----

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.