You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by SingleShot <mi...@gmail.com> on 2006/06/16 00:33:56 UTC

Merge Two Classpath Documents?

I have two documents that I would like to merge using XSLT, and I would like
to access them via the classpath. I thought the XSLT document() function
would be the way to go, but it appears to only work on file paths. What
mechanism (if any) should be used to access classpath documents from and
XSLT? Is there a Xalan-specific way of doing this?

Thanks,

Mike
--
View this message in context: http://www.nabble.com/Merge-Two-Classpath-Documents--t1795135.html#a4891833
Sent from the Xalan - J - Users forum at Nabble.com.


RE : Re: Merge Two Classpath Documents?

Posted by Florent Georges <da...@yahoo.fr>.
SingleShot wrote:

  Hi

> I've figured out one way (which I don't like) is to create my own
> "URIResolver" programmatically:

> [...]

> and then use the XSLT document() function:

>         <xsl:variable name="MyDocument"
> select="document('MyDocument.xml')"/>

  I think in this case I'd use a reusable 'classpath' scheme:

    document('classpath:MyDocument.xml')

  Regards,

--drkm
























__________________________________________________
Do You Yahoo!?
En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités 
http://mail.yahoo.fr Yahoo! Mail 

Re: Merge Two Classpath Documents?

Posted by SingleShot <mi...@gmail.com>.
I've figured out one way (which I don't like) is to create my own
"URIResolver" programmatically:

        TransformerFactory transformerFactory =
TransformerFactory.newInstance();
        Transformer transformer = transformerFactory.newTransformer(new
StreamSource(transform));
        transformer.setURIResolver(new URIResolver() {
            public Source resolve(String href, String base) throws
TransformerException {
                // get document from classpath 
            }
        });

and then use the XSLT document() function:

        <xsl:variable name="MyDocument"
select="document('MyDocument.xml')"/>
--
View this message in context: http://www.nabble.com/Merge-Two-Classpath-Documents--t1795135.html#a4892061
Sent from the Xalan - J - Users forum at Nabble.com.