Browse Source

Throw in a reuseloadedstylesheet attribute for <style> (feel free to

come up with a better name).  This provides a workaround for a bug in
Xalan-J - the version that gets distributed with JDK 1.4.1.

PR: 13859

based on a patch submitted by:	Jens Elkner <elkner at linofee.org>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273545 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
411b9f267d
3 changed files with 31 additions and 1 deletions
  1. +3
    -0
      WHATSNEW
  2. +8
    -0
      docs/manual/CoreTasks/style.html
  3. +20
    -1
      src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java

+ 3
- 0
WHATSNEW View File

@@ -106,6 +106,9 @@ Other changes:

* Shipped XML parser is now Xerces 2.2.1

* <style> has a new attribute reuseloadedstylesheet to work around a
bug in widespread Xalan versions.

Changes from Ant 1.5.1Beta1 to 1.5.1
====================================



+ 8
- 0
docs/manual/CoreTasks/style.html View File

@@ -151,6 +151,14 @@ element which is used to perform Entity and URI resolution</p>
directories. Default is <code>true</code></td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">reuseloadedstylesheet</td>
<td valign="top">Reuse the same transformer when transforming
multiple files. If you set this to false, performance will
suffer, but you may work around a bug in certain Xalan-J versions.
Default is <code>true</code>. <em>Since Ant 1.6</em>.</td>
<td valign="top" align="center">No</td>
</tr>
</table>
<h3>Parameters specified as nested elements</h3>
<h4>classpath</h4>


+ 20
- 1
src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java View File

@@ -157,6 +157,12 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*/
private Factory factory = null;

/**
* whether to reuse Transformer if transforming multiple files.
* @since 1.6
*/
private boolean reuseLoadedStylesheet = true;

/**
* Creates a new XSLTProcess Task.
*/
@@ -175,6 +181,19 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
performDirectoryScan = b;
}

/**
* Whether to reuse the transformer instance when transforming
* multiple files.
*
* <p>Setting this to false may get around a bug in certain
* Xalan-J version, default is true.</p>
*
* @since Ant 1.6
*/
public void setReuseLoadedStylesheet(boolean b) {
reuseLoadedStylesheet = b;
}

/**
* Executes the task.
*
@@ -713,7 +732,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @exception BuildException if the stylesheet cannot be loaded.
*/
protected void configureLiaison(File stylesheet) throws BuildException {
if (stylesheetLoaded) {
if (stylesheetLoaded && reuseLoadedStylesheet) {
return;
}
stylesheetLoaded = true;


Loading…
Cancel
Save