Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

[jdom-interest] How to specify a basedir from the Transformer

Patrick JUSSEAU

2004-12-29

Replies:

Hi,

I am using JDOM to perform an XSL transformation. The problem I have is
that my XSL Document refers to an external file using the document(URL)
method. I don't want to use an absolute URL. What I would like to do is
tell JDOM (the Transformer) what the basedir is (/Users/aUser) so that
in my XSL file I could use:

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

and aFile.xml would abvioulsy be in /Users/aUser


Here is the code I am using


Document p_sourceDocument = ....
Document p_xslDocument = ....

// Create a JDOMSource from the source JDOM Document
     JDOMSource source = new JDOMSource(p_sourceDocument);

     // Create a JDOMSource from the source XSL Document
     JDOMSource xslSource = new JDOMSource(p_xslDocument);

     // Get a XSLT Transformer
     Transformer transformer =
getTransformerFactory().newTransformer(xslSource);

     // Create a JDOMResult
     JDOMResult result = new JDOMResult();

     // Populate the Result
     transformer.transform(source, result);


I guess there must be some way to tell the underlying Transformer what
the basedir is?

Thanks,

Patrick

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.