Re: Re: Re: How to distinguish b/n a scalar and a node-set h
David, This is a good idea and it actually works in MSXML 3: count(node-set(nodeSet) | node-set(nodeSet)) returns 1. count(node-set(Scalar) | node-set(Scalar)) returns 2. Unfortunately, Saxon always returns 1. Also, I've heard that the standard node-set() function in XSLT 1.1 will throw error when passed a scalar argument. Thanks once again, Dimitre Novatchev. -------------------- Original message -------------------- Date: Wed, 1 Nov 2000 09:59:15 -0400 (EST) From: David_Marston@xxxxxxxxx Subject: Re: Re: How to distinguish b/n a scalar and a node-set having a single text node Dimitre Novatchev wrote: >> I am trying to determine whether the value of a parameter is a >> scalar [boolean/number/string] >> or a node-set, and to do so without using extension functions (I >> consider node-set() to be "standard", as it will be in XSLT 1.1). >... >>The only unsolved case remains when $pValue contains exactly one >>text node. Depending on what node-set(string) does, you may be able to build something based on unions. If $pValue is a node-set, then ($pValue | $pValue) is a node-set with the same count, because it's a union of two references to the same node-set. Unfortunately, putting a "scalar" string in either a union or count() is an error. If node-set($pValue) for a scalar $pValue produces a different node-set on each invocation, then the union of two of them will yield a node-set with a count() of 2. If node-set($pValue) for $pValue being a node-set already simply passes through the same node-set, then the union of two of them will yield a node-set with a count() of 1. .................David Marston __________________________________________________ Do You Yahoo!? >From homework help to love advice, Yahoo! Experts has your answer. http://experts.yahoo.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format