[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Saxon-CE -- Passing Data to a JS Function
As you've already found, passing data from Saxon-CE XSLT to a JS function requires some extra care. Firstly, it really helps to explicitly cast a value to the type expected in the JS function, either by passing in a typed variable (as you've done) or wrapping the argument in a cast expression - e.g. xs:string(@value). There shouldn't be a problem passing an XML node, or sequence of nodes to a JS function. Saxon-CE (if memory serves) manages nodes internally as compatible DOM nodes, these are just wrapped for the purpose of XSLT processing. One suggestion - it is possible to pass JS object literals back and forth from Saxon-CE to JS functions. This might be easier than constructing a JSON string. Note that you may experience problems when passing empty sequences as JS function parameters, to avoid confusion I often deliberately add a dummy item to the start of a sequence in Saxon-CE, and then simply ignore this first item on the JS side. Phil Fearon
|
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
|