ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Kay" <>
Subject XSLT task - files processed twice
Date Thu, 09 Oct 2008 14:25:11 GMT
I have a variant of the xslt task for processing Saxon transformations. It
seems to have a bug that is also present in the base xslt task (which
contains a lot of code that I copied), and I'm not sure how to fix it.

Basically, given this input

	<target name="saxon">
			force="true" >
			<mapper type="glob" from="*.template.xml"

It's processing each of the input files (that is, each file matching
in/*.template.xml) twice.

The relevant code is:

                // Process all the files marked for styling
                list = scanner.getIncludedFiles();
                for (int i = 0; i < list.length; ++i) {
                    process(baseDir, list[i], destDir, xslResource);
                if (performDirectoryScan) {
                    // Process all the directories marked for styling
                    dirs = scanner.getIncludedDirectories();
                    for (int j = 0; j < dirs.length; ++j) {
                        list = new File(baseDir, dirs[j]).list();
                        for (int i = 0; i < list.length; ++i) {
                            process(baseDir, dirs[j] + File.separator +
                                    destDir, xslResource);

and the first transformation is being done as a result of
getIncludedFiles(), the second as a result of getIncludedDirectories().

Now, the "performDirectoryScan" flag corresponds to the external property
scanIncludedDirectories, and its default value is true.

Adding scanIncludedDirectories="false" to the task cures the problem. But
why would anyone want to set it to true, and why is true the default value?

Michael Kay

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message