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

distinguish whether variable holds string or node set

Subject: distinguish whether variable holds string or node set
From: TW <zupftom@xxxxxxxxxxxxxx>
Date: Sun, 13 Jun 2010 09:51:50 +0200
 distinguish whether variable holds string or node set
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:

<xsl:template name="my-template">
  <xsl:param name="arg"/>
  <xsl:choose>
    <xsl:when test="pseudo test: type($arg)='node-set'">Do something</xsl:when>
    <xsl:otherwise>Do something else</xsl:otherwise>
  </xsl:choose>
</xsl:template>

I've so far not been able to find an answer to this on the web and in
the archives. XPath makes it pretty hard with all the implicit type
conversion e.g. when testing equality. I hoped that any of the XPath
functions that expect a node set as an argument would maybe return an
empty string/node set or false when a string is passed as an argument,
but this will only stop processing with an error.

I'm looking for an XSLT 1.0 solution as I want it to work in browsers.

TIA
Thomas W.

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.