From 197f9ee4ec7343a06970c466ceb29fe51678521b Mon Sep 17 00:00:00 2001
From: Stefan Bodewig 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> +