You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "brian m. carlson" <sa...@crustytoothpaste.ath.cx> on 2009/08/13 23:38:12 UTC

xslt task only on files in a subdirectory

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

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

prepatch:
     [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

postpatch:
     [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

BUILD SUCCESSFUL
Total time: 0 seconds

Thanks for your time.

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

Re: xslt task only on files in a subdirectory

Posted by "brian m. carlson" <sa...@crustytoothpaste.ath.cx>.
On Thu, Aug 13, 2009 at 09:38:12PM +0000, brian m. carlson wrote:
> 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.

Ah, I found the problem: I needed to use the useImplicitFileset="false"
option, which I hadn't seen since my manual was out-of-date.

Thanks anyway, and sorry for the bother.

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

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