Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 20th, 2009, 07:40 AM
Registered User
 
Join Date: Dec 2007
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default number function in XPATH1.0 and decimal type in xml schema

Hi,

We are using XSLT1.0.
Our inbound SOAP request contains a decimal type element, which is sometimes populated with a + sign. According to W3 specifications '+' sign is valid. But as per XPATH1.0 specification, number () doesn't support a '+' sign. It returns an 'NaN'.

It appears like there is a gap between these two specifications. Is there any workaround to this issue? or am i missing something?

Any help in this regard is greatly appreciated.

Thanks,
Sudhish
 
Old February 20th, 2009, 07:45 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

XPath 1.0 only has support for one number data type which is a double data type. As for using that decimal type, if the '+' sign is all that is different you could strip it e.g.
number(translate(foo, '+', ''))
(where foo is the element containing the decimal number).
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
The Following User Says Thank You to Martin Honnen For This Useful Post:
kssudhish (February 20th, 2009)
 
Old February 20th, 2009, 08:27 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You can solve the problem by moving forward to XSLT 2.0 / XPath 2.0, or by manually stripping off the "+" sign.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Schema derived type and the base type bonekrusher XML 5 January 8th, 2008 09:04 AM
decimal data type all 0's after decimal gobotsoup SQL Server ASP 1 February 28th, 2007 02:32 PM
function to create whole number from decimal dhx10000 Classic ASP Professional 1 July 18th, 2006 08:17 PM
round up a decimal number semooth VB How-To 3 October 4th, 2005 02:33 PM
number of decimal? hosefo81 PHP How-To 1 February 11th, 2004 02:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.