[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

Subject: Re: Saxon-CE -- Passing Data to a JS Function
From: "Philip Fearon pgfearo@xxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 14 Jul 2016 12:03:33 -0000
 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

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.