[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|