diff --git a/build.xml b/build.xml index da486f354..70b158d11 100644 --- a/build.xml +++ b/build.xml @@ -166,6 +166,13 @@ + + + @@ -236,6 +243,7 @@ + @@ -663,6 +671,8 @@ unless="xslp.present"/> + @@ -744,6 +754,11 @@ + + + diff --git a/docs/manual/CoreTasks/style.html b/docs/manual/CoreTasks/style.html index d15444e1d..1918ad48c 100644 --- a/docs/manual/CoreTasks/style.html +++ b/docs/manual/CoreTasks/style.html @@ -87,11 +87,14 @@ inclusion/exclusion of files works, and how to write patterns.

name of the XSLT processor to use. Permissible values are "trax" for a TraX compliant processor, "xslp" for the XSL:P processor, "xalan" for the Apache XML Xalan (version 1) - processor, or the name of an arbitrary XSLTLiaison class. Defaults to trax, - followed by xslp then xalan (in that order). The first one found in your - class path is the one that is used. - DEPRECATED - XSL:P is deprecated and will be removed - in the next version. Use trax or xalan instead.. + processor, "adaptx" for the Exolab Adaptx processor + or the name of an arbitrary XSLTLiaison class. Defaults to trax, + followed by xalan, then adaptx and then xslp (in that + order). The first one found in your class path is the one that + is used. + DEPRECATED - XSL:P and Adaptx are + deprecated and will be removed in the next version. Use trax or + xalan instead.. No diff --git a/docs/manual/install.html b/docs/manual/install.html index 513788c6d..8f20d833f 100644 --- a/docs/manual/install.html +++ b/docs/manual/install.html @@ -249,11 +249,13 @@ Installing Ant / Optional Tasks section above.

Available At - An XSL transformer like Xalan or XSL:P + An XSL transformer like Xalan, Adaptx or XSL:P style task http://xml.apache.org/xalan-j/index.html or http://xml.apache.org/xalan-j/index.html, + CVS module adaptx from :pserver:anoncvs@virtuals.intalio.com:/cvs/adaptx + with password anoncvs + or http://www.clc-marketing.com/xslp/ @@ -262,7 +264,7 @@ Installing Ant / Optional Tasks section above.

jakarta.apache.org/regexp/ - jakarta-oro-2.0.1.jar + jakarta-oro-2.0.4.jar regexp type with mappers and the perforce tasks jakarta.apache.org/oro/ diff --git a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java index 4e90c408d..f6a9dd644 100644 --- a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java +++ b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java @@ -278,6 +278,11 @@ public class XSLTProcess extends MatchingTask { final Class clazz = loadClass("org.apache.tools.ant.taskdefs.optional.XalanLiaison"); liaison = (XSLTLiaison)clazz.newInstance(); + } else if (proc.equals("adaptx")) { + log("DEPRECATED - adaptx processor is deprecated. Use trax or xalan instead."); + final Class clazz = + loadClass("org.apache.tools.ant.taskdefs.optional.AdaptxLiaison"); + liaison = (XSLTLiaison) clazz.newInstance(); } else { liaison = (XSLTLiaison) loadClass(proc).newInstance(); } @@ -402,14 +407,19 @@ public class XSLTProcess extends MatchingTask { resolveProcessor("trax"); } catch (Throwable e1) { try { - resolveProcessor("xslp"); + resolveProcessor("xalan"); } catch (Throwable e2) { try { - resolveProcessor("xalan"); + resolveProcessor("adaptx"); } catch (Throwable e3) { - e3.printStackTrace(); - e2.printStackTrace(); - throw new BuildException(e1); + try { + resolveProcessor("xslp"); + } catch (Throwable e4) { + e4.printStackTrace(); + e3.printStackTrace(); + e2.printStackTrace(); + throw new BuildException(e1); + } } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/AdaptxLiaison.java b/src/main/org/apache/tools/ant/taskdefs/optional/AdaptxLiaison.java new file mode 100644 index 000000000..6132519b7 --- /dev/null +++ b/src/main/org/apache/tools/ant/taskdefs/optional/AdaptxLiaison.java @@ -0,0 +1,96 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2001 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Ant", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ + +package org.apache.tools.ant.taskdefs.optional; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStreamWriter; + +import org.apache.tools.ant.taskdefs.XSLTLiaison; + +import org.exolab.adaptx.xslt.XSLTProcessor; +import org.exolab.adaptx.xslt.XSLTReader; +import org.exolab.adaptx.xslt.XSLTStylesheet; + +/** + * + * @author Arnaud Blandin + * @version $Revision$ $Date$ + */ +public class AdaptxLiaison implements XSLTLiaison { + + protected XSLTProcessor processor; + protected XSLTStylesheet xslSheet; + + public AdaptxLiaison () { + processor = new XSLTProcessor(); + } + + public void setStylesheet(File fileName) throws Exception { + XSLTReader xslReader = new XSLTReader(); + xslSheet = xslReader.read( fileName.getAbsolutePath() ); + }; + + public void transform(File infile, File outfile) throws Exception { + FileOutputStream fos = new FileOutputStream(outfile); + OutputStreamWriter out = new OutputStreamWriter(fos,"UTF8"); + processor.process(infile.getAbsolutePath(), xslSheet, out); + } + + public void addParam(String name, String expression){ + processor.setProperty(name, expression); + } + +} //-- AdaptxLiaison diff --git a/src/testcases/org/apache/tools/ant/taskdefs/optional/AdaptxLiaisonTest.java b/src/testcases/org/apache/tools/ant/taskdefs/optional/AdaptxLiaisonTest.java new file mode 100644 index 000000000..3c4500c4e --- /dev/null +++ b/src/testcases/org/apache/tools/ant/taskdefs/optional/AdaptxLiaisonTest.java @@ -0,0 +1,72 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2001 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Jakarta-Regexp", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + * + */ + +package org.apache.tools.ant.taskdefs.optional; + +import org.apache.tools.ant.taskdefs.XSLTLiaison; + +/** + * Adaptx Liaison testcase + * @author Stefan Bodewig + */ +public class AdaptxLiaisonTest extends AbstractXSLTLiaisonTest { + public AdaptxLiaisonTest(String name){ + super(name); + } + + protected XSLTLiaison createLiaison() throws Exception { + return new AdaptxLiaison(); + } +}