[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: TW <zupftom@xxxxxxxxxxxxxx>
Date: Mon, 14 Jun 2010 11:57:50 +0200
Re:  distinguish whether variable holds string or node
2010/6/14 David Carlisle <davidc@xxxxxxxxx>:
> If you are needing to test the types for some other reason, rather than ask
> how to test the types, you should ask yourself why your template is being
> called with the parameter set to different types.

My example was made up, I really don't have a template that has to
check a parameter type.  What I have is a template that evaluates a
very, very tiny subset of XPath for addressing nodes.  I know, an eval
function is also in EXSL, but I also want some special behavior when
the XPath snippet "points to" a non-existent attribute node.  If
attributes are present, they have a static value, if not, they get a
calculated "dynamic" value depending on context (when accessed using
the mentioned template).

I can't return such a fake attribute as an attribute node, it will be
a string or a number.  What I'm tackling is further processing the
mixture of nodes and strings that this template produces.  But I think
I can change things so that I can safely interpret everything that's
produced by the template as a string.  I could also have a plan-A
template, and if this returns an empty nodeset, I go with a plan-B
template.  I would know that plan-A returns a node set, plan-B a
string.  The result of plan-A could serve as a test for switches that
I may have to build in.

Thanks for your suggestions

Thomas W.

Current Thread


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.
First Name
Last Name
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.