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

Re: distinguish whether variable holds string or node

Subject: Re: distinguish whether variable holds string or node set
From: David Carlisle <davidc@xxxxxxxxx>
Date: Sun, 13 Jun 2010 10:51:02 +0100
Re:  distinguish whether variable holds string or node
On 13/06/2010 08:51, TW wrote:
Hi,

sorry for the messed up message I sent from my other mail account.  I
should have known that it wouldn't work as I experienced this issue
before.

Is there a way to determine whether a variable holds a string or a
node set? Something like:

no in xslt 1 all you can do is a static analysis of all teh places where your template is called and see if it is called with the smae type always.

<xsl:template name="my-template"> <xsl:param name="arg"/>
Note that makes the default value an epty string which is dangerous if the value passed in is going to be a node set and you want to do $arg/some/path. Safer is to declare it as
<xsl:param name="arg" select="/.."/>
so the default value is a (empty) node set and then it is safe to do
$arg/some/path
without having to test the type, so long as you always pass in a node set.


David

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.