XSLTC redirect:write file= does not respect Ant task destdir attribute

201 Views Asked by At

I have an Ant xslt task that looks like this:

<xslt 
     basedir="${target.dir}"
     destdir="${target.dir}"
     style="${target.dir}/event.xsl"
     includes="*.xml"
     excludes="*Common.xml"
     extension=".tmp.log"
     force="yes"
     >
</xslt>

Within event.xsl I have a directive:

<xsl:stylesheet version="1.0"
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
            xmlns:redirect="http://xml.apache.org/xalan/redirect"
            xmlns:java="java"
            extension-element-prefixes="redirect"
            >

[other stuff to set $filename]

<redirect:write select="$filename">

For Xalan-J this works exactly as expected, where the generated files are written to destdir.

I'm trying to remove the Xalan-J dependency to use the default XSLTC in Java 1.4+. XSLTC does not respect select in this context. Instead, the suggestion was to replace it with:

<redirect:write file="{$filename}"

This works correctly, except the files are written to the current working directory instead of destdir. The .tmp.log files correctly end up in destdir.

Anyone know why destdir is getting ignored by XSLTC's redirect:write? And how to fix it?

There are a few workarounds, like making a build.xml for that directory and use the Ant task "ant" to call with destdir as the working directory. Or I could fork to effective chdir in Ant to a similar end. But the kludge would be unnecessary if destdir was respected as it was under Xalan-J.

0

There are 0 best solutions below