You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Carlos <cs...@netscape.net> on 2007/02/05 13:28:36 UTC

XSLT task in Ant 1.7.0+saxon8 fails when processing more than one file

Hi. I'm using Ant 1.7.0 and I need XSLT 2.0, so I'm using saxon8.jar
by adding a "classpath" element to the "xslt" element in the Ant
script.

My problem is that the XSLT task behaves strangely when used for a set
of files (using basedir,destdir and extension attributes), although it
works OK for a single file (in,out attributes). I'm attaching an example in
a tar.gz
file with a build.xml file, two XML files and one XSL file. The build.xml
has 3 different targets that more or less do the same, but only two of
them work: using in/out with saxon8 works, using
basedir/destdir/extension without saxon8 also works, but using
basedir/destdir/extension with saxon8 fails, with the following output

$ ant transform
Buildfile: build.xml

transform:
     [xslt] Transforming into c:\tt\antbug\example\gen-src
     [xslt] Processing c:\tt\antbug\example\src\one.xml to
c:\tt\antbug\example\
gen-src\one.gen
     [xslt] Loading stylesheet c:\tt\antbug\example\style.xsl
     [xslt] Processing c:\tt\antbug\example\src\two.xml to
c:\tt\antbug\example\
gen-src\two.gen
     [xslt] c:\tt\antbug\example\style.xsl:12: Fatal Error! Cannot write an
impl
icit result document if an explicit result document has been written to the
same
 URI: file:/c:/tt/antbug/example/gen-src/one.gen
     [xslt] Failed to process null

BUILD FAILED
c:\tt\antbug\example\build.xml:9: Fatal error during transformation

Total time: 1 second


As you can see, when processing the second file (two.xml -> two.gen),
it fails but the error message refers to the URI of the output of the
first file (one.gen).

The target that fails looks like this:

<target name="transform">
		<xslt style="style.xsl" 
			destdir="gen-src"
			basedir="src"		
			includes="*.xml"
			extension=".gen">
			<classpath location="lib/saxon8.jar"/>
		</xslt>            
  </target>



If I use Ant 1.6.5, then everything works OK. I'm also attaching the
output of "ant -diagnostics", in case something is wrong with my
configuration.

Can anybody tell me what I'm doing wrong?

Thanks,

Carlos

P.S.: to run the example in the .tar.gz you'll need to copy saxon8.jar to
the lib directory

http://www.nabble.com/file/6251/example.tar.gz example.tar.gz 
http://www.nabble.com/file/6252/ant165-diagnostics.txt
ant165-diagnostics.txt 
http://www.nabble.com/file/6253/ant170-diagnostics.txt
ant170-diagnostics.txt 
-- 
View this message in context: http://www.nabble.com/XSLT-task-in-Ant-1.7.0%2Bsaxon8-fails-when-processing-more-than-one-file-tf3174024.html#a8805330
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: XSLT task in Ant 1.7.0+saxon8 fails when processing more than one file

Posted by Carlos <cs...@netscape.net>.
 I've found a workaround: using reloadstylesheet="true". Could it be then a
problem with Saxon? But then, why is it working with Ant 1.6.5?

Thanks,

Carlos


Carlos wrote:
> 
> Hi. I'm using Ant 1.7.0 and I need XSLT 2.0, so I'm using saxon8.jar
> by adding a "classpath" element to the "xslt" element in the Ant
> script.
> 
> My problem is that the XSLT task behaves strangely when used for a set
> of files (using basedir,destdir and extension attributes), although it
> works OK for a single file (in,out attributes). I'm attaching an example
> in a tar.gz
> file with a build.xml file, two XML files and one XSL file. The build.xml
> has 3 different targets that more or less do the same, but only two of
> them work: using in/out with saxon8 works, using
> basedir/destdir/extension without saxon8 also works, but using
> basedir/destdir/extension with saxon8 fails, with the following output
> 
> $ ant transform
> Buildfile: build.xml
> 
> transform:
>      [xslt] Transforming into c:\tt\antbug\example\gen-src
>      [xslt] Processing c:\tt\antbug\example\src\one.xml to
> c:\tt\antbug\example\
> gen-src\one.gen
>      [xslt] Loading stylesheet c:\tt\antbug\example\style.xsl
>      [xslt] Processing c:\tt\antbug\example\src\two.xml to
> c:\tt\antbug\example\
> gen-src\two.gen
>      [xslt] c:\tt\antbug\example\style.xsl:12: Fatal Error! Cannot write
> an impl
> icit result document if an explicit result document has been written to
> the same
>  URI: file:/c:/tt/antbug/example/gen-src/one.gen
>      [xslt] Failed to process null
> 
> BUILD FAILED
> c:\tt\antbug\example\build.xml:9: Fatal error during transformation
> 
> Total time: 1 second
> 
> 
> As you can see, when processing the second file (two.xml -> two.gen),
> it fails but the error message refers to the URI of the output of the
> first file (one.gen).
> 
> The target that fails looks like this:
> 
> <target name="transform">
> 		<xslt style="style.xsl" 
> 			destdir="gen-src"
> 			basedir="src"		
> 			includes="*.xml"
> 			extension=".gen">
> 			<classpath location="lib/saxon8.jar"/>
> 		</xslt>            
>   </target>
> 
> 
> 
> If I use Ant 1.6.5, then everything works OK. I'm also attaching the
> output of "ant -diagnostics", in case something is wrong with my
> configuration.
> 
> Can anybody tell me what I'm doing wrong?
> 
> Thanks,
> 
> Carlos
> 
> P.S.: to run the example in the .tar.gz you'll need to copy saxon8.jar to
> the lib directory
> 
>  http://www.nabble.com/file/6251/example.tar.gz example.tar.gz 
>  http://www.nabble.com/file/6252/ant165-diagnostics.txt
> ant165-diagnostics.txt 
>  http://www.nabble.com/file/6253/ant170-diagnostics.txt
> ant170-diagnostics.txt 
> 

-- 
View this message in context: http://www.nabble.com/XSLT-task-in-Ant-1.7.0%2Bsaxon8-fails-when-processing-more-than-one-file-tf3174024.html#a8807050
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org