<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.0.9">
</HEAD>
<BODY>
On Wed, 2004-12-29 at 18:08, Per Norrman wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE><FONT COLOR="#737373"><I>Ken Roberts wrote:
> On Wed, 2004-12-29 at 17:27, Per Norrman wrote:
>
>>/Ken Roberts wrote:
>>> 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.
>>>
>><irony>
>> Thank you very much for that timely and accurate piece of information.
>></irony>
>>
>>Serioulsy, next time, please read the entire thread before jumping in ...
>>
>>/pmn/
>>
>
> Per,
>
> Sorry if my solution seems old-school, but I had read the entire thread.
>
> You answered the direct question of telling that the underlying
> transformer has no such setting. I tried to answer the next question by
> indirection.
Aha, so you *anticipated* that the next question would be "Now that I have the
URIResolver, and knowing that this specific URIResolver uses a system property
to resolve relative urls, what can I possibly to do get that darn system
property set?", and answered that question before it was posed.
If that's the case, your'e too quick for the rest of us.</I></FONT></PRE>
</BLOCKQUOTE>
<BR>
No, I went down the other path from the one you suggested, which is to set a system property based on an environment variable. I did it to offer a different solution to the same problem, since a URIResolver didn't exactly fit the needs I had when I implemented my solution.<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<PRE><FONT COLOR="#737373"><I>There are all sorts of ways to define a base directory,
> and the one I have used in the past is what I described because it fit
> more easily with our needs. Your solution would take 10 minutes
Actually, I said 10 *lines* of code.</I></FONT></PRE>
</BLOCKQUOTE>
<BR>
As opposed to:<BR>
<BR>
File myBaseDir = new File(System.getProperty("mybasedir"));<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<PRE><FONT COLOR="#737373"><I>Let's not continue this off-topic thread ...</I></FONT></PRE>
</BLOCKQUOTE>
<BR>
Sure. We can stop as soon as you stop flaming me. I have in no way earned this treatment, and as a matter of fact I have a few months to spend on this if you like. Sarcasm and bitterness has no place on a forum such as this. We're not in a contest to see who's the brightest programmer, we're offering solutions to problems that people might have.<BR>
<BR>
Whether my solution was in style or not, it did satisfy a certain category of business needs. Generally it's considered a good idea to look at multiple solutions before making a design decision, and you offered one solution. I offered another.<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<PRE><FONT COLOR="#737373"><I>> code, you said, and mine took maybe 5. Which is correct depends a lot
> on your application needs.
>
> The interesting bit is that your solution and mine would both be placed
> in just about the same place in whatever code one would write. Since it
> can't be done (by your statement) internally to the XSL parser, it would
> have to be done in the wrapping code, no matter what the solution.
>
> Passing an environment variable is quaint and maybe not very elegant,
> but it does work. I shared it because the original poster asked
> specifically about passing system properties. Since the JVM used to
> pass the environment of the operating system in but no longer does, I
> thought my contribution was pertinent.
>
>>/> 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@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:
>>>>>>> //_//_</FONT><A HREF="http://www.jdom.org/mailman/options/jdom-interest/__"><U>http://www.jdom.org/mailman/options/jdom-interest/__</U></A><FONT COLOR="#737373"> youraddr@yourhost.com
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> To control your jdom-interest membership:
>>>>>> __</FONT><A HREF="http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com__"><U>http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com__</U></A>
<FONT COLOR="#737373">>>>>>>
>>>>>
>>>>>
>>>>
>>>>_______________________________________________
>>>>To control your jdom-interest membership:
>>>>__</FONT><A HREF="http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com__"><U>http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com__</U></A>
<FONT COLOR="#737373">>>>>/
>>>>
>>/
>>
</I></FONT></PRE>
</BLOCKQUOTE>
</BODY>
</HTML>