Re: [xsl] Marshalling data (function parameters) into XSLT

Subject: Re: [xsl] Marshalling data (function parameters) into XSLT
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Thu, 25 Sep 2008 09:23:14 -0700
There is a standard way to do this in .NET:

Dimitre Novatchev
Truly great madness cannot be achieved without significant intelligence.
To invent, you need a good imagination and a pile of junk
Never fight an inanimate object
You've achieved success in your field when you don't know whether what
you're doing is work or play

On 9/25/08, Justin Johansson <procode@xxxxxxxxxxx> wrote:
> Hello XSLT List,
> Given a scenario of using XSLT as a generic functional computation engine,
> (and thereby invoking an XSLT transform to implement the internals of a
> function,
> say, in the same way as one might use the Java Native Interface (JNI) to
> implement a function in C++) ...
> What is the most efficient was to marshall external data into the transform
> engine as "parameters to the XSLT-implemented function"?
> Me thinks there are only two ways and please correct me if I am wrong :-
> 1) Serialize the function parameters into an XML formatted character stream
> and feed this into the transform as the source document
> 2) Pass the parameters into the transform via Transform.setParameter
> (perhaps using an empty source document to satisfy the XSLT Transformer
> need for a source document)
> There is an obvious overhead in serializing using (1) if the parameters
> already exist as native Java types.
> Using (2) requires that the external (Java) driver can supply data types
> directly to Transform.setParameter, and this sounds like a more efficient
> way (to save the serializing overhead of 1).
> To reduce the assumptions that this question might pose, let's assume a use
> case in the first instance,
> Use case A:
>        Use XSLT to implement a simple arithmetic addition of two integers
> predisposed as Java int's.
> Use case B:
>        Use XSLT to implement a reduce (or fold), in functional parlance, a
> sequence of values predisposed as, say, a Java Vector<double>.
> Thanks for the list's consideration of my question,
> Justin Johansson

Current Thread