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

Re: Cannot get numeric value - what am I doing wrong?

Subject: Re: Cannot get numeric value - what am I doing wrong?
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 18 Mar 2004 17:39:53 -0500
get numeric value from string
Hi Kyle,

At 04:44 PM 3/18/2004, you wrote:
So...HOW COME I wind up with a Node-Fragment type assigned to my
variable, when all is said and done???  I need the value to be a numeric
value, so that when I test to see if it is boolean true or false, it
will react properly.

You're getting a Result Tree Fragment assigned to the variable because that's what you're building by calling a template. Unfortunately, the only way to get another type assigned to a variable is with the select attribute, which won't work if you need to call out like that.


Fortunately, the remedy is easy enough. Cast the RTF to a number by using the number() function when you test it, as in test="number($top-remove)". It will then be made into a number (NaN if its string value doesn't represent a number), and will test Boolean-wise the way you want it.

Good luck,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



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-2013 All Rights Reserved.