diff --git a/WHATSNEW b/WHATSNEW
index d528bbd33..19024bda9 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -570,6 +570,11 @@ Other changes:
transform is empty.
Bugzilla Report 46274.
+ * It is now possible to define system properties that should be set
+ during xslt's transformation. This can be used to enable XInclude
+ processing in Xerces, for example.
+ Bugzilla Report 36653.
+
Changes from Ant 1.7.0 TO Ant 1.7.1
=============================================
diff --git a/docs/manual/CoreTasks/style.html b/docs/manual/CoreTasks/style.html
index 04ee7db3b..bf6b9193e 100644
--- a/docs/manual/CoreTasks/style.html
+++ b/docs/manual/CoreTasks/style.html
@@ -419,6 +419,22 @@ this element, the stylesheet should be specified as a nested resource or
single-element collection. Alternatively, use the refid
to
specify the resource or collection as a reference.
Use nested <sysproperty>
elements to specify
+system properties required by the factory or transformation. These
+properties will be made available to the VM during the execution of
+the class. The attributes for this element are the same as
+for environment variables.
since Ant 1.8.0.
+ +You can specify a set of properties to be used as system properties +with syspropertysets.
+ +since Ant 1.8.0.
+diff --git a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java index f2d6b2372..fac6608ab 100644 --- a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java +++ b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java @@ -26,8 +26,11 @@ import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.DynamicConfigurator; import org.apache.tools.ant.Project; +import org.apache.tools.ant.types.CommandlineJava; +import org.apache.tools.ant.types.Environment; import org.apache.tools.ant.types.Mapper; import org.apache.tools.ant.types.Path; +import org.apache.tools.ant.types.PropertySet; import org.apache.tools.ant.types.Reference; import org.apache.tools.ant.types.Resource; import org.apache.tools.ant.types.ResourceCollection; @@ -198,6 +201,14 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { */ private boolean failOnNoResources = true; + /** + * System properties to set during transformation. + * + * @since Ant 1.8.0 + */ + private CommandlineJava.SysProperties sysProperties = + new CommandlineJava.SysProperties(); + /** * Creates a new XSLTProcess Task. */ @@ -321,6 +332,10 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { return; } try { + if (sysProperties.size() > 0) { + sysProperties.setSystem(); + } + Resource styleResource; if (baseDir == null) { baseDir = getProject().getBaseDir(); @@ -410,6 +425,9 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { loader.cleanup(); loader = null; } + if (sysProperties.size() > 0) { + sysProperties.restoreSystem(); + } liaison = null; stylesheetLoaded = false; baseDir = savedBaseDir; @@ -595,6 +613,24 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { failOnNoResources = b; } + /** + * A system property to set during transformation. + * + * @since Ant 1.8.0 + */ + public void addSysproperty(Environment.Variable sysp) { + sysProperties.addVariable(sysp); + } + + /** + * A set of system properties to set during transformation. + * + * @since Ant 1.8.0 + */ + public void addSyspropertyset(PropertySet sysp) { + sysProperties.addSyspropertyset(sysp); + } + /** * Load processor here instead of in setProcessor - this will be * called from within execute, so we have access to the latest@@ -511,6 +527,15 @@ specify the resource or collection as a reference. </xsl:stylesheet>+Use an XInclude-aware version of Xerces while transforming
+ ++<xslt ...> + <sysproperty key="org.apache.xerces.xni.parser.XMLParserConfiguration" + value="org.apache.xerces.parsers.XIncludeParserConfiguration" + /> +<xslt> +