ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "brian m. carlson" <>
Subject xslt task only on files in a subdirectory
Date Thu, 13 Aug 2009 21:38:12 GMT
I have a project that contains some XML files in a directory called
"src".  However, because I must perform several conversions on them, I
copy them to a directory called "build" and then run the xslt task on
them several times.  I want to run this task only on the files that have
been copied to build, and additionally leave the resulting files in
build (with a different extension).  Therefore, a file originally called
src/foo.xml should first be copied to build/foo.xml and then transformed
into build/foo.tmp and then into build/foo.xhtml.

However, despite my best attempts, I cannot get ant to run the xslt task
only on the files within the build directory that have a given glob
pattern.  It seems to operate on any file with the given extension that
it can get its hands on, and additionally copies them into odd places.
I've tried to fool with the xslt destdir attribute and the fileset dir
attribute, but neither seems to produce quite the right results.  In
this testcase, the sole source file is src/foo.xml, and I'd like to have
ant produce build, build/foo.xml, build/foo.tmp, and build/foo.xhtml,
and nothing else.

I've looked through the both the manual and the past few months of list
archives and didn't see any clues; Google has been similarly unhelpful.

The build.xml file has been attached (inline), and the output is below.

lakeview ok % ant -version
Apache Ant version 1.7.1 compiled on August 9 2009
lakeview ok % java -version
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.5) (6b16-4)
OpenJDK 64-Bit Server VM (build 14.0-b15, mixed mode)
lakeview ok % ant 
Buildfile: build.xml

    [mkdir] Created dir: /home/bmc/tmp/ant-testcase/build
     [copy] Copying 1 file to /home/bmc/tmp/ant-testcase/build

     [xslt] Transforming into /home/bmc/tmp/ant-testcase/build
     [xslt] Processing /home/bmc/tmp/ant-testcase/build.xml to /home/bmc/tmp/ant-testcase/build/build.tmp
     [xslt] Loading stylesheet /home/bmc/tmp/ant-testcase/prepatch.xsl
     [xslt] Processing /home/bmc/tmp/ant-testcase/build/foo.xml to /home/bmc/tmp/ant-testcase/build/build/foo.tmp
     [xslt] Processing /home/bmc/tmp/ant-testcase/src/foo.xml to /home/bmc/tmp/ant-testcase/build/src/foo.tmp
     [xslt] Processing /home/bmc/tmp/ant-testcase/build/foo.xml to /home/bmc/tmp/ant-testcase/build/foo.tmp

     [xslt] Transforming into /home/bmc/tmp/ant-testcase/build
     [xslt] Processing /home/bmc/tmp/ant-testcase/build/build.tmp to /home/bmc/tmp/ant-testcase/build/build/build.xhtml
     [xslt] Loading stylesheet /home/bmc/tmp/ant-testcase/xhtml.xsl
     [xslt] Processing /home/bmc/tmp/ant-testcase/build/build/foo.tmp to /home/bmc/tmp/ant-testcase/build/build/build/foo.xhtml
     [xslt] Processing /home/bmc/tmp/ant-testcase/build/foo.tmp to /home/bmc/tmp/ant-testcase/build/build/foo.xhtml
     [xslt] Processing /home/bmc/tmp/ant-testcase/build/src/foo.tmp to /home/bmc/tmp/ant-testcase/build/build/src/foo.xhtml
     [xslt] Processing /home/bmc/tmp/ant-testcase/build/build.tmp to /home/bmc/tmp/ant-testcase/build/build.xhtml
     [xslt] Processing /home/bmc/tmp/ant-testcase/build/foo.tmp to /home/bmc/tmp/ant-testcase/build/foo.xhtml

Total time: 0 seconds

Thanks for your time.

brian m. carlson / brian with sandals: Houston, Texas, US
+1 713 440 7475 | | My opinion only
OpenPGP: RSA v4 4096b 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187

View raw message