xsl-list
[Top] [All Lists]

Re: [xsl] distinguish whether variable holds string or node set

2010-06-13 04:52:13
TW wrote:

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'm looking for an XSLT 1.0 solution as I want it to work in browsers.

ESLT has object-type
http://www.exslt.org/exsl/functions/object-type/index.html
Firefox supports that since Firefox 3.0 I think, I am not sure about other browsers, as libxslt supports that function and I think Safari and Google chrome use libxslt chances are they support it.
I don't think MSXML used by IE supports it.


--

        Martin Honnen
        http://msmvps.com/blogs/martin_honnen/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--