ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject <style> and entities
Date Fri, 17 May 2002 23:34:59 GMT
Hi,

Just started using <style> in ANT 1.4.1, and right away I've hit a snag:

My build.xml is not at the root of my project, but in a build/ directory
(and has the basedir=".." attribute). It includes an XML fragment as an
entity using a relative path ./fragment.xml. I have a build.bat at the
project root that calls ant -buildfile build/build.xml. Everything works
fine with ANT.

Now I added a build.xsl stylesheet transformation next to my build.xml, and
want to generate build.html using the 'style' target shown below.
Unfortunately, this target fails with:

C:\acme\build\build.xml:1329: javax.xml.transform.TransformerException:
java.io.FileNotFound
Exception: .\fragment.xml (The system cannot find the file specified)

To make the <style> work, I had to create a style.xml in the build directory
so that build.xml, fragment.xml, style.xml, and build.xsl are all in the
same directory, and call from it inside the build directory. If I can this
little style.xml (using ANT) from the project root, it fails again.

So it seems that entities are resolved based on the directory the ant
command is run from, rather than the directory of either the file
transformed (as ANT's XML parser does) or the stylesheet.

What can I do? -DD

C:\acme\build.bat
C:\acme\build\build.xml
C:\acme\build\build.xsl
C:\acme\build\style.xml

<?xml version="1.0"?>

<!DOCTYPE project [
  <!ENTITY sysproperties SYSTEM "file:./fragment.xml">
]>

<project name="acme" default="style" basedir="..">
  <target name="style">
    <style in="${basedir}/build/build.xml"
           out="${basedir}/build/build.html"
           style="${basedir}/build/build.xsl" />
  </target>
  ...
</project>

Mime
View raw message