This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Re: How to distinguish b/n a scalar and a node-set having a single textnode
- To: xsl-list at mulberrytech dot com
- Subject: Re: Re: How to distinguish b/n a scalar and a node-set having a single textnode
- From: David_Marston at lotus dot com
- Date: Wed, 1 Nov 2000 09:59:15 -0400 (EST)
- Reply-To: xsl-list at mulberrytech dot com
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
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list