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

Re: Parameter Type problem

Subject: Re: Parameter Type problem
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 25 Jan 2002 18:24:36 +0000
Re:  Parameter Type problem
Hi Karen,

> The problem is the parameter is then of string type and not node...
> How can I "cast" it to a node?

I'm afraid that in XSLT 1.0 you can't simply cast it to a node,
because to do so, the processor would have to dynamically evaluate the
expression that you'd just constructed.

There are two ways that you can get round this, though. The first is
to use an evaluate() extension function to do the 'cast'. The
evaluate() extension function that you use depends on your processor:
in Saxon it's saxon:evaluate(), in Xalan it's xalan:evaluate(), in
MSXML you have to write your own.

The second way around in this case is to use a path of the form:

  @*[name() = $name]

In other words, select those attributes whose name is the same as the
value of the $name parameter.

In fact, because the $tmplg parameter starts with a '@' you need
to do one of the following:

 - don't add the '@' at the beginning of $tmplg in the first place and
   then use @*[name() = $tmplg]
 - use @*[concat('@', name()) = $tmplg]
 - use @*[name() = substring($tmplg, 2)]



Jeni Tennison

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

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.