RE: [xsl] how do I pass two xml document into a xsl in java

Subject: RE: [xsl] how do I pass two xml document into a xsl in java
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Wed, 19 Sep 2001 22:28:13 +0100
> Thanks, I understand it and think it will work
> only downside is it requires hard coding the global variable 
> in xsl file which I don't really want to.

You can always do:
<xsl:variable name="doc2" select="document($docname)"/>
<xsl:param name="docname"/>

So that the URL is passed as a stylesheet parameter, as a string.

Mike Kay
> 
> John
> 
> -----Original Message-----
> From: Michael Kay [mailto:mhkay@xxxxxxxxxxxx]
> Sent: Tuesday, September 18, 2001 5:13 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] how do I pass two xml document into a xsl in java
> 
> 
> With most processors you can pass a document as the value of 
> a stylesheet
> parameter, though I don't think this is defined in JAXP.
> 
> What you can do, though, is to make your calling application 
> implement the
> URIResolver interface; nominate this class as your 
> URIResolver; in your
> stylesheet have a global variable
> 
> <xsl:variable name="doc2" select="document('my:doc2')"/>
> 
> and in your resolve() method, return the relevant Source object if the
> requested URI is "my:doc2", (and return null otherwise).
> 
> Mike Kay
> 
> > -----Original Message-----
> > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of
> > john.li@xxxxxxxxx
> > Sent: 18 September 2001 22:00
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: [xsl] how do I pass two xml document into a xsl in java
> >
> >
> > Hi, xsl and java gurus,
> >
> > I use javax.xml.transform.Transformer.transform method to
> > transform one xml
> > file, now my xsl file needs to transform two xml files.  The
> > problem is the
> > transform method takes only one Source object only. I don't
> > want to have to
> > save the java xml document to files and have the xsl file to
> > read from the
> > files because it will slow down the app.
> >
> > Any solution to how I can specify two xml documents and
> > transform them in
> > xsl? and how would xsl refer to these two different sources?
> >
> > Thanks
> > John
> >
> >  XSL-List info and archive:  
> http://www.mulberrytech.com/xsl/xsl-list
> >
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

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


Current Thread