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

RE: Character from numeric code? double->integer cast?

Subject: RE: Character from numeric code? double->integer cast?
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Wed, 29 Jun 2005 08:53:08 +0100
cast double to integer
> <xsl:variable name="cb"
> select="codepoints-to-string(number(substring('#CB00001', 4))
> + 983040)"/>
>
> This does not work, Saxon 8.1B complains that I am providing
> an xs:double, but the function codepoints-to-string wants a
> xs:integer. Now, how on earth do I get number() to give me an
> integer?  I have tried combinations using the "as" attribute,
> with an intermediate variable but then Saxon wonders about
> the namespace "xs:" .  It looks like I am missing something
> fundamental here, sigh.

Use xs:integer() instead of number() and add the namespace:

xmlns:xs="http://www.w3.org/2001/XMLSchema"

Your new variable definition should look like:

<xsl:variable name="cb"
select="codepoints-to-string(xs:integer(substring('#CB00001', 4)) +
983040)"/>
                                                     ^^^^^^^^^^

cheers
andrew

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.