You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2016/09/04 14:25:37 UTC
[8/9] ant git commit: allow Ant references to be used for xslt
attributes
allow Ant references to be used for xslt attributes
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/2cec63f6
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/2cec63f6
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/2cec63f6
Branch: refs/heads/master
Commit: 2cec63f68a7d43b7645135df6ba8da3a84cce912
Parents: 7e55fea
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sun Sep 4 16:24:18 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sun Sep 4 16:24:18 2016 +0200
----------------------------------------------------------------------
WHATSNEW | 3 ++
manual/Tasks/style.html | 32 +++++++++++++++++++-
.../apache/tools/ant/taskdefs/XSLTProcess.java | 13 +++++++-
3 files changed, 46 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/2cec63f6/WHATSNEW
----------------------------------------------------------------------
diff --git a/WHATSNEW b/WHATSNEW
index 3a23c1f..7a9e070 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -86,6 +86,9 @@ Other changes:
* it is now possible to set features of the TraX factory used by <xslt>
and <junitreport>.
+ * it is now possible to use references to Ant types and classloaders
+ built around Ant <path>s as values for TraX factory attributes.
+
Changes from Ant 1.9.6 TO Ant 1.9.7
===================================
http://git-wip-us.apache.org/repos/asf/ant/blob/2cec63f6/manual/Tasks/style.html
----------------------------------------------------------------------
diff --git a/manual/Tasks/style.html b/manual/Tasks/style.html
index 32fa621..5eda026 100644
--- a/manual/Tasks/style.html
+++ b/manual/Tasks/style.html
@@ -431,9 +431,39 @@ And in Saxon 7.x:
<tr>
<td valign="top">value</td>
<td valign="top">value of the attribute.</td>
- <td align="center" valign="top">Yes</td>
+ <td align="center" valign="middle" rowspan="3">Exactly one of these</td>
+ </tr>
+ <tr>
+ <td valign="top">valueref</td>
+ <td valign="top">value of the attribute is the value of the
+ project reference with the given id. <em>since Ant 1.9.8</em></td>
+ </tr>
+ <tr>
+ <td valign="top">classloaderforpath</td>
+ <td valign="top">value of the attribute is a classloader that uses
+ the classpath specified by a path that is the project reference
+ with the given id. <em>since Ant 1.9.8</em></td>
</tr>
</table>
+
+<h4>Examples</h4>
+
+<pre>
+ <path id="extension-path">
+ ...
+ </path>
+
+
+ <xslt ...>
+ <factory>
+ <attribute name="jdk.xml.transform.extensionClassLoader"
+ classloaderforpath="extension-path"/>
+ </factory>
+ </xslt ...>
+</pre>
+<p>Sets the classloader to use when loading extension functions to a
+ classloader using the <code>path</code> with the
+ id <code>extension-path</code>.
</blockquote>
<h4>feature</h4>
<p><em>since Ant 1.9.8</em></p>
http://git-wip-us.apache.org/repos/asf/ant/blob/2cec63f6/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
index 6f54d1d..f9c53ea 100644
--- a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
+++ b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
@@ -39,6 +39,7 @@ 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.ProjectComponent;
import org.apache.tools.ant.PropertyHelper;
import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.Environment;
@@ -53,6 +54,7 @@ import org.apache.tools.ant.types.resources.FileProvider;
import org.apache.tools.ant.types.resources.FileResource;
import org.apache.tools.ant.types.resources.Resources;
import org.apache.tools.ant.types.resources.Union;
+import org.apache.tools.ant.util.ClasspathUtils;
import org.apache.tools.ant.util.FileNameMapper;
import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.ResourceUtils;
@@ -1525,7 +1527,9 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* <li>http://xml.apache.org/xalan/features/incremental (true|false) </li>
* </ul>
*/
- public static class Attribute implements DynamicConfigurator {
+ public static class Attribute
+ extends ProjectComponent
+ implements DynamicConfigurator {
/** attribute name, mostly processor specific */
private String name;
@@ -1582,6 +1586,13 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
this.value = value;
}
}
+ } else if ("valueref".equalsIgnoreCase(name)) {
+ this.value = getProject().getReference(value);
+ } else if ("classloaderforpath".equalsIgnoreCase(name)) {
+ this.value =
+ ClasspathUtils.getClassLoaderForPath(getProject(),
+ new Reference(getProject(),
+ value));
} else {
throw new BuildException("Unsupported attribute: " + name);
}