Browse Source

add filenamemapper support to <xslt>.

Bugzilla 37604. Submitted by Maarten Coene.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@348509 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 19 years ago
parent
commit
db060df3c3
5 changed files with 33 additions and 2 deletions
  1. +1
    -0
      CONTRIBUTORS
  2. +4
    -1
      WHATSNEW
  3. +9
    -1
      src/etc/testcases/taskdefs/style/build.xml
  4. +12
    -0
      src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
  5. +7
    -0
      src/testcases/org/apache/tools/ant/taskdefs/StyleTest.java

+ 1
- 0
CONTRIBUTORS View File

@@ -130,6 +130,7 @@ Les Hughes
Levi Cook
lucas
Ludovic Claude
Maarten Coene
Magesh Umasankar
Maneesh Sahu
Marcel Schutte


+ 4
- 1
WHATSNEW View File

@@ -309,7 +309,10 @@ Other changes:

* New task <makeurl> that can turn a file reference into an absolute file://
url; and nested filesets/paths into a (space, comma, whatever) separated
list of URLs. Useful for RMI classpath setup, amongst other things.
list of URLs. Useful for RMI classpath setup, amongst other things.

* <xslt> now accepts nested FileNameMappers e.g. <globmapper>.
Bugzilla report 37604.


Changes from Ant 1.6.4 to Ant 1.6.5


+ 9
- 1
src/etc/testcases/taskdefs/style/build.xml View File

@@ -57,6 +57,14 @@
</xslt>
</target>

<target name="testTypedMapper">
<property name="value" value="myvalue"/>
<xslt style="printParams.xsl" destDir="${out.dir}" basedir=".">
<param name="set" expression="${value}"/>
<globmapper from="data.*" to="out.*"/>
</xslt>
</target>

<target name="testExplicitFileset">
<property name="value" value="myvalue"/>
<xslt style="printParams.xsl" destDir="${out.dir}"
@@ -99,4 +107,4 @@
</copy>
</target>

</project>
</project>

+ 12
- 0
src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java View File

@@ -213,6 +213,18 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
resources.add(rc);
}

/**
* Adds a nested filenamemapper.
* @param fileNameMapper the mapper to add
* @exception BuildException if more than one mapper is defined
* @since Ant 1.7.0
*/
public void add(FileNameMapper fileNameMapper) throws BuildException {
Mapper mapper = new Mapper(getProject());
mapper.add(fileNameMapper);
addMapper(mapper);
}
/**
* Executes the task.
*


+ 7
- 0
src/testcases/org/apache/tools/ant/taskdefs/StyleTest.java View File

@@ -105,6 +105,13 @@ public class StyleTest extends BuildFileTest {
"set='myvalue'");
}

public void testTypedMapper() throws Exception {
assertTrue(!getProject().resolveFile("out/out.xml").exists());
expectFileContains("testTypedMapper",
"out/out.xml",
"set='myvalue'");
}

public void testDirectoryHierarchyWithDirMatching() throws Exception {
executeTarget("testDirectoryHierarchyWithDirMatching");
assertTrue(getProject().resolveFile("out/dest/level1/data.html")


Loading…
Cancel
Save