Subject: Re: [xsl] escaping from CDATA From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Fri, 26 Oct 2001 13:21:55 +0100 |
Hi Steve, > Thanks Jeni. I got a version of the following to work but I don't > understand why I need the reference to string() - isn't that the > problem that my node is text in the first place - why do I have to > convert it to a string? When you set the $arg variable with: <xsl:variable name="arg" select="."/> it's set to a node set containing the current node. The equivalent to a node set in Javascript is a NodeList object, so when you pass $arg to the user:createNodeset() function, the arg argument in the Javascript is set to a NodeList. The loadXML() method, on the other hand, is expecting a string. So either you have to make sure that the kind of value you pass to the function is a string (by converting it to a string using the string() XPath function, as you've found), or you have to make sure that your extension function accepts a NodeList and does something sensible with it (i.e. gets the string value of the first node in the NodeList). This is an illustration of the fact that with Javascript extension functions, the XSLT processor cannot automatically convert the argument you pass to the extension function to a string because it doesn't know that the extension function is expecting a string. If you were using a strongly typed language, on the other hand, then it could. I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] escaping from CDATA, Steve Renshaw | Thread | RE: [xsl] escaping from CDATA, Michael Kay |
RE: [xsl] UnknownHostException, Julian Reschke | Date | Re: xsl:lang (was Re: [xsl] <sort l, Joerg Pietschmann |
Month |