diff --git a/WHATSNEW b/WHATSNEW
index ea03c4685..e2a337b8e 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -419,6 +419,9 @@ Other changes:
* now optionally supports the sftp protocol. Bugzilla Report 39373.
+* resources can now be used to indicate the location of the stylesheet to use
+ in . Bugzilla Report 39407.
+
Changes from Ant 1.6.4 to Ant 1.6.5
===================================
diff --git a/docs/manual/CoreTasks/style.html b/docs/manual/CoreTasks/style.html
index bd9e6ace9..1db2dea86 100644
--- a/docs/manual/CoreTasks/style.html
+++ b/docs/manual/CoreTasks/style.html
@@ -82,12 +82,15 @@ element which is used to perform Entity and URI resolution.
name of the stylesheet to use - given either relative
to the project's basedir or as an absolute path.
+ Alternatively, a nested element which ant can interpret as a resource
+ can be used to indicate where to find the stylesheet
deprecated variation :
If the stylesheet cannot be found, and if you have specified the
attribute basedir for the task, ant will assume that the style
attribute is relative to the basedir of the task.
|
- Yes |
+ No, if you specify the location of
+ the stylesheet as a nested resource element |
classpath |
@@ -348,6 +351,13 @@ used by <xslt>
removes the file extension from the
source file and adds the extension specified via the extension
attribute.
+nested element of type resource to indicate the stylesheet
+
+Since Ant 1.7
+
+You can use nested elements which extend resource to indicate the stylesheet.
+See resources to see the concrete syntax you can use
+
Examples
@@ -407,6 +417,14 @@ attribute.
style="style/apache.xsl">
<mapper type="glob" from="*.xml.en" to="*.html.en"/>
</xslt>
+
+ Using a nested resource to define the stylesheet
+
+<xslt in="data.xml" out="${out.dir}/out.xml">
+ <url url="${printParams.xsl.url}"/>
+ <param name="set" expression="value"/>
+</xslt>
+
Copyright © 2000-2006 The Apache Software Foundation. All rights
diff --git a/src/etc/testcases/taskdefs/style/build.xml b/src/etc/testcases/taskdefs/style/build.xml
index 2dc985c95..d92a73dec 100644
--- a/src/etc/testcases/taskdefs/style/build.xml
+++ b/src/etc/testcases/taskdefs/style/build.xml
@@ -107,4 +107,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/org/apache/tools/ant/taskdefs/XSLTLiaison3.java b/src/main/org/apache/tools/ant/taskdefs/XSLTLiaison3.java
new file mode 100644
index 000000000..0ae8d94ae
--- /dev/null
+++ b/src/main/org/apache/tools/ant/taskdefs/XSLTLiaison3.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.tools.ant.taskdefs;
+
+import org.apache.tools.ant.types.Resource;
+
+/**
+ * Extends Proxy interface for XSLT processors.
+ *
+ * @see XSLTProcess
+ * @since Ant 1.7
+ */
+public interface XSLTLiaison3 extends XSLTLiaison2 {
+ /**
+ * sets the stylesheet to use as a resource
+ * @param stylesheet the stylesheet to use as a resource
+ * @throws Exception if the stylesheet cannot be loaded
+ */
+ void setStylesheet(Resource stylesheet) throws Exception;
+}
diff --git a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
index e9e5977d1..2ba1ef727 100644
--- a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
+++ b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
@@ -54,9 +54,12 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
/** where to find the source XML file, default is the project's basedir */
private File baseDir = null;
- /** XSL stylesheet */
+ /** XSL stylesheet as a filename */
private String xslFile = null;
+ /** XSL stylesheet as a {@link org.apache.tools.ant.types.Resource} */
+ private Resource xslResource = null;
+
/** extension of the files produced by XSL processing */
private String targetExtension = ".html";
@@ -217,7 +220,17 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @since Ant 1.7
*/
public void add(ResourceCollection rc) {
- resources.add(rc);
+ resources.add(rc);
+ }
+
+ /**
+ * Adds the XSLT stylesheet as a resource
+ * @param xslResource the stylesheet as a
+ * {@link org.apache.tools.ant.types.Resource}
+ * @since Ant 1.7
+ */
+ public void addConfigured(Resource xslResource) {
+ this.xslResource = xslResource;
}
/**
@@ -231,7 +244,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
mapper.add(fileNameMapper);
addMapper(mapper);
}
-
+
/**
* Executes the task.
*
@@ -240,7 +253,8 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*/
public void execute() throws BuildException {
if ("style".equals(getTaskType())) {
- log("Warning: the task name