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

Ken Roberts ken at 9ci.com
Wed Dec 29 15:04:50 PST 2004


Passing in a system property to a JVM is done by specifying
-Dvariable=value, no spaces on the command line.

Doing this inside JBoss means editing your run.bat file or your run.sh
file, or (if redhat) the jboss_init_redhat.sh file.


On Wed, 2004-12-29 at 16:38, Per Norrman wrote:

> Patrick JUSSEAU wrote:
> > Hi,
> > 
> > So there is no way to pass in a system property to set this up?
> > 
> Not that I'm aware of, no.
> 
> > I guess the other solution would be to put all the files I need in the  
> > same directory but I would rather have the option to set the base dir  
> > of the external file that is referenced from the document() method.
> 
> But that is exactly what you would/could do with an URIResolver. It is less
> that 10 lines of code to have a URIResolver resolve a relative url using a
> system property as the base uri.
> 
> /pmn
> 
> 
> > 
> > Patrick
> > 
> > On 29 Dec 2004, at 19:51, Per Norrman wrote:
> > 
> >> Hi,
> >>
> >> I believe you can use the Transformer#setURIResolver method.
> >>
> >> /pmn
> >>
> >>
> >> patrick at openbase.com wrote:
> >>
> >>> 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 at yourhost.com
> >>
> >>
> >> _______________________________________________
> >> To control your jdom-interest membership:
> >> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
> >>
> > 
> > 
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20041229/a022dd5e/attachment.htm


More information about the jdom-interest mailing list