Re: [xsl] streaming multiple XML input

Subject: Re: [xsl] streaming multiple XML input
From: Mike Brown <mike@xxxxxxxx>
Date: Tue, 21 Aug 2001 13:57:41 -0600 (MDT)
Luc Pionchon wrote:
> is there anyway to give to a XSLTprocessor several XML entries, except by
> "hardcoding" a file name with "document(xxx.xml)"
> actually, i wanted to avoid using files, but using streams.
> basicaly something like this (~):
> 
>    transf.setXSLT("xxx.xsl");
>    transformer.convert(inputStream1, inputStream2, outputStream);

An XSLT processor always has exactly one "main" source tree that it is
processing, consisting of a root node, if nothing else. I tried a long
time ago to make a case for there to be a default source tree consisting
of nothing but the root node, so that XSLT processors would not have to
have *any* input, necessarily, but this fell on deaf ears.

I don't think you could make a case for multiple "main" source trees,
since there is no facility in XSLT for distinguishing between them. So if
you need to access multiple source documents, you must access them through
the document() function, or through an extension function that returns a
node-set.

If you have the option of using a servlet that returns, via HTTP, a
document in response to a URI like http://myhost/getstream?num=2, then
that is probably the easiest thing to implement.

You could avoid HTTP altogether by inventing your own URI scheme like 
"getstream", as in document('getstream:stream2'), and then having your 
application supply its own javax.xml.transform.URIResolver that will 
return a javax.xml.transform.Source appropriately. I don't know where to 
look for examples of this being done, though.

   - Mike
____________________________________________________________________________
  mike j. brown, fourthought.com  |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  personal: http://hyperreal.org/~mike/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread