|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: escaping from CDATA
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
|
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
|

Cart








