michux 0 Newbie Poster

Hi,

Here is my use case
- I have a Java app from which I'm calling an XSLT to transform XML into HTML
- The XSLT is a file in JAR
- The XML is passed as a stream from another application

Now, the problem is:
- I need to pass another XML document to this XSLT, from a different application and then access it as a node in XSLT

Here are the alternatives I can think of :
1. Using the document() xslt function with XML as stream.
I tried doing it with document() function but it doesn't seem to work in Saxon when the document has to be passed as stream. Here is my moaning: http://groups.google.com/group/XSLT/browse_thread/thread/e52442738196933e

2. Using the document() xslt function by refering to an external document (using REST)
I don't really like that idea, as I'd have to expose the service for providing additional data as REST (lots of issues with that, especially permissioning is tricky)

3. Passing the XML documents as parameters to XSLT using something like:

XsltTransformer trans = comp.compile(new StreamSource(MyTransformerClass.getResourceAsStream(XSLT_FILE)).load();
trans.setParameter(new QName(paramName), new XdmAtomicValue(params.get(paramName)));
but with using a XdmNode instead of the XdmAtomicValue.

A few issues with this solution:
- I'm not sure how create an XdmNode - it does not have a public constructor (but probably there is a way, more investigation is needed here)
- More important: not sure if I can use parameters are nodes in XSLT, so that I could declare something like:
<xsl:param name="operatingSystems" as="xs:node" required="yes" />
and then use XPath like $operatingSystems/system[@name='Linux']/defaultHomeDirectory

4. Adding the additional XML at the end of the source XML for my XSLT.

A VERY very ugly solution which just works....

I'm be very glad to hear your ideas!

michuk