ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephane Bailliez <sbaill...@imediation.com>
Subject RE: Strange java/fork behavior with xalan
Date Thu, 26 Jul 2001 07:59:11 GMT
Eric,

1) Pay attention when you are forking a java task that requires an url as a
parameter.
The urls always have to be absolute because you never know where will be
located your vm and the resolution of a relative path may depends on the
strategy of you java app.

Best thing is to always use the 'location' attribute and not 'value'. Just
in case
<property name="outfile.wo.ext" location="${output.dir}/${file.wo.ext}"/>

2) I believe xalan will be happier if you give him a systemId the following
way:
       <arg line="-IN file:///${input.file}
		-XSL file:///${xhtml.driver}
		-OUT file:///${output.file}"/>

In your post xalan incorrectly resolve your systemId and does something like
${working.dir} + url

3) You can do the same with style task (assuming you have xalan in ur
classpath and you will have to tune the ant vm here):
<style processor="trax" in="${input.file}" out="${output.file}"
style="${xhtml.driver}"/>

-- 
 Stephane Bailliez 
 Software Engineer, Paris - France 
 iMediation - http://www.imediation.com 
 Disclaimer: All the opinions expressed above are mine and not those from my
company. 


> -----Original Message-----
> From: Eric Richardson [mailto:eric.richardson@milagrosoft.com]
> Sent: Wednesday, July 25, 2001 9:00 PM
> To: ant-user
> Subject: Strange java/fork behavior with xalan
> 
> 
> Hi,
> Something is happening during the java task, fork="true" which changes
> the value of my input file variable. I need to use fork as 
> xalan 2_2_D6
> won't work other wise. The only way I can get it to work is by setting
> the xalan classpath in the shell prior to running ant which I really
> don't want to do. The following shows the target and the outputs.
> 
>  <target name="html" if="htmlset">
>     <!-- make sure directories exist -->
>     <mkdir dir="${output.dir}"/>
> 
>     <!-- some properties -->
>     <property name="outfile.wo.ext"
> value="${output.dir}/${file.wo.ext}"/>
>     <property name="output.file" value="${outfile.wo.ext}.html"/> 
> 
>     <echo message="Transforming: ${input.file}"/>
>     <echo message="Into        : ${output.file}"/>
> 
>     <!-- Transform document into HTML -->
>     <java fork="false"
> 	  classname="${xslt.processor}"
>           classpathref="xalan.classpath"> 
>       <arg line="-IN ${input.file}
> 	   -XSL ${xhtml.driver} 
> 	   -OUT ${output.file}"/>
>     </java>      
>   </target>
> 
> Without fork output
> ------------------
> 
> Buildfile: bin/../build.xml
> 
> html:
>      [echo] Transforming: example.xml
>      [echo] Into        : ./example.html
> 
> XSLT Error (javax.xml.transform.TransformerConfigurationException):
> Namespace not supported by SAXParser
> --------------------------------
> 
> With fork on the java task it parses the XSL file okay but then makes
> the input file into the following which can't be found.
> 
> Buildfile: /home/maxwell/jdocbook/build.xml
> 
> html:
>      [echo] Transforming: /home/maxwell/jdocbook/example.xml
>      [echo] Into        : /home/maxwell/jdocbook/example.html
>      [java] 
>      [java] XSLT Error 
> (javax.xml.transform.TransformerException): File
> "file:////home/maxwell/jdocbook//home/maxwell/jdocbook/example
.xml" not
found.

The strange thing is that the echo looks fine. What could cause this?

Thanks,
Eric

Mime
View raw message