[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


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

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
Keywords
xml