[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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)] Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|