Submitted by: Arnaud Blandin <blandin@intalio.com> git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269832 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -166,6 +166,13 @@ | |||||
| <available property="servlet.present" | <available property="servlet.present" | ||||
| classname="javax.servlet.Servlet" | classname="javax.servlet.Servlet" | ||||
| classpathref="classpath"/> | classpathref="classpath"/> | ||||
| <available property="adaptx.present" | |||||
| classname="org.exolab.adaptx.xslt.XSLTProcessor" | |||||
| classpathref="classpath" /> | |||||
| <available property="xerces.present" | |||||
| classname="org.apache.xerces.parsers.SAXParser" | |||||
| classpathref="classpath" /> | |||||
| <condition property="javamail.complete"> | <condition property="javamail.complete"> | ||||
| <and> | <and> | ||||
| @@ -236,6 +243,7 @@ | |||||
| <exclude name="${optional.package}/NetRexxC.java" unless="netrexx.present" /> | <exclude name="${optional.package}/NetRexxC.java" unless="netrexx.present" /> | ||||
| <exclude name="${optional.package}/XslpLiaison.java" unless="xslp.present" /> | <exclude name="${optional.package}/XslpLiaison.java" unless="xslp.present" /> | ||||
| <exclude name="${optional.package}/XalanLiaison.java" unless="xalan.present" /> | <exclude name="${optional.package}/XalanLiaison.java" unless="xalan.present" /> | ||||
| <exclude name="${optional.package}/AdaptxLiaison.java" unless="adaptx.present" /> | |||||
| <exclude name="${optional.package}/ejb/Ejbc*.java" unless="ejb.ejbc.present" /> | <exclude name="${optional.package}/ejb/Ejbc*.java" unless="ejb.ejbc.present" /> | ||||
| <exclude name="${optional.package}/ejb/DDCreator*.java" unless="ejb.DDCreator.present" /> | <exclude name="${optional.package}/ejb/DDCreator*.java" unless="ejb.DDCreator.present" /> | ||||
| <exclude name="${optional.package}/ejb/WLRun.java" unless="ejb.wls.present" /> | <exclude name="${optional.package}/ejb/WLRun.java" unless="ejb.wls.present" /> | ||||
| @@ -663,6 +671,8 @@ | |||||
| unless="xslp.present"/> | unless="xslp.present"/> | ||||
| <exclude name="org/apache/tools/ant/taskdefs/optional/XalanLiaisonTest.java" | <exclude name="org/apache/tools/ant/taskdefs/optional/XalanLiaisonTest.java" | ||||
| unless="xalan.present"/> | unless="xalan.present"/> | ||||
| <exclude name="org/apache/tools/ant/taskdefs/optional/AdaptxLiaisonTest.java" | |||||
| unless="adaptx.present"/> | |||||
| </javac> | </javac> | ||||
| </target> | </target> | ||||
| @@ -744,6 +754,11 @@ | |||||
| <exclude name="org/apache/tools/ant/taskdefs/optional/AbstractXSLTLiaisonTest.java" /> | <exclude name="org/apache/tools/ant/taskdefs/optional/AbstractXSLTLiaisonTest.java" /> | ||||
| <exclude name="org/apache/tools/ant/taskdefs/optional/XslpLiaisonTest.java" unless="xslp.present"/> | <exclude name="org/apache/tools/ant/taskdefs/optional/XslpLiaisonTest.java" unless="xslp.present"/> | ||||
| <exclude name="org/apache/tools/ant/taskdefs/optional/XalanLiaisonTest.java" unless="xalan.present"/> | <exclude name="org/apache/tools/ant/taskdefs/optional/XalanLiaisonTest.java" unless="xalan.present"/> | ||||
| <exclude name="org/apache/tools/ant/taskdefs/optional/AdaptxLiaisonTest.java" | |||||
| unless="adaptx.present"/> | |||||
| <exclude name="org/apache/tools/ant/taskdefs/optional/AdaptxLiaisonTest.java" | |||||
| unless="xerces.present"/> | |||||
| <!-- ehm, this is not really a TraX test but rather a xalan2 test..--> | <!-- ehm, this is not really a TraX test but rather a xalan2 test..--> | ||||
| <exclude name="org/apache/tools/ant/taskdefs/optional/TraXLiaisonTest.java" unless="xalan2.present"/> | <exclude name="org/apache/tools/ant/taskdefs/optional/TraXLiaisonTest.java" unless="xalan2.present"/> | ||||
| @@ -87,11 +87,14 @@ inclusion/exclusion of files works, and how to write patterns.</p> | |||||
| <td valign="top">name of the XSLT processor to use. Permissible values are | <td valign="top">name of the XSLT processor to use. Permissible values are | ||||
| "trax" for a TraX compliant processor, "xslp" for the | "trax" for a TraX compliant processor, "xslp" for the | ||||
| XSL:P processor, "xalan" for the Apache XML Xalan (version 1) | 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. | |||||
| <em><strong>DEPRECATED</strong> - XSL:P is deprecated and will be removed | |||||
| in the next version. Use trax or xalan instead.</em>. | |||||
| 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. | |||||
| <em><strong>DEPRECATED</strong> - XSL:P and Adaptx are | |||||
| deprecated and will be removed in the next version. Use trax or | |||||
| xalan instead.</em>. | |||||
| </td> | </td> | ||||
| <td align="center" valign="top">No</td> | <td align="center" valign="top">No</td> | ||||
| </tr> | </tr> | ||||
| @@ -249,11 +249,13 @@ Installing Ant / Optional Tasks</a> section above.</p> | |||||
| <td><b>Available At</b></td> | <td><b>Available At</b></td> | ||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| <td>An XSL transformer like Xalan or XSL:P</td> | |||||
| <td>An XSL transformer like Xalan, Adaptx or XSL:P</td> | |||||
| <td>style task</td> | <td>style task</td> | ||||
| <td><a href="http://xml.apache.org/xalan-j/index.html" | <td><a href="http://xml.apache.org/xalan-j/index.html" | ||||
| target="_top">http://xml.apache.org/xalan-j/index.html</a> or <a | |||||
| href="http://www.clc-marketing.com/xslp/" | |||||
| target="_top">http://xml.apache.org/xalan-j/index.html</a>, | |||||
| CVS module adaptx from :pserver:anoncvs@virtuals.intalio.com:/cvs/adaptx | |||||
| with password anoncvs | |||||
| or <a href="http://www.clc-marketing.com/xslp/" | |||||
| target="_top">http://www.clc-marketing.com/xslp/</a></td> | target="_top">http://www.clc-marketing.com/xslp/</a></td> | ||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| @@ -262,7 +264,7 @@ Installing Ant / Optional Tasks</a> section above.</p> | |||||
| <td><a href="http://jakarta.apache.org/regexp/" target="_top">jakarta.apache.org/regexp/</a></td> | <td><a href="http://jakarta.apache.org/regexp/" target="_top">jakarta.apache.org/regexp/</a></td> | ||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| <td>jakarta-oro-2.0.1.jar</td> | |||||
| <td>jakarta-oro-2.0.4.jar</td> | |||||
| <td>regexp type with mappers and the perforce tasks</td> | <td>regexp type with mappers and the perforce tasks</td> | ||||
| <td><a href="http://jakarta.apache.org/oro/" target="_top">jakarta.apache.org/oro/</a></td> | <td><a href="http://jakarta.apache.org/oro/" target="_top">jakarta.apache.org/oro/</a></td> | ||||
| </tr> | </tr> | ||||
| @@ -278,6 +278,11 @@ public class XSLTProcess extends MatchingTask { | |||||
| final Class clazz = | final Class clazz = | ||||
| loadClass("org.apache.tools.ant.taskdefs.optional.XalanLiaison"); | loadClass("org.apache.tools.ant.taskdefs.optional.XalanLiaison"); | ||||
| liaison = (XSLTLiaison)clazz.newInstance(); | 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 { | } else { | ||||
| liaison = (XSLTLiaison) loadClass(proc).newInstance(); | liaison = (XSLTLiaison) loadClass(proc).newInstance(); | ||||
| } | } | ||||
| @@ -402,14 +407,19 @@ public class XSLTProcess extends MatchingTask { | |||||
| resolveProcessor("trax"); | resolveProcessor("trax"); | ||||
| } catch (Throwable e1) { | } catch (Throwable e1) { | ||||
| try { | try { | ||||
| resolveProcessor("xslp"); | |||||
| resolveProcessor("xalan"); | |||||
| } catch (Throwable e2) { | } catch (Throwable e2) { | ||||
| try { | try { | ||||
| resolveProcessor("xalan"); | |||||
| resolveProcessor("adaptx"); | |||||
| } catch (Throwable e3) { | } 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); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -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 | |||||
| * <http://www.apache.org/>. | |||||
| */ | |||||
| 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 <a href="mailto:blandin@intalio.com">Arnaud Blandin</a> | |||||
| * @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 | |||||
| @@ -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 | |||||
| * <http://www.apache.org/>. | |||||
| * | |||||
| */ | |||||
| package org.apache.tools.ant.taskdefs.optional; | |||||
| import org.apache.tools.ant.taskdefs.XSLTLiaison; | |||||
| /** | |||||
| * Adaptx Liaison testcase | |||||
| * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | |||||
| */ | |||||
| public class AdaptxLiaisonTest extends AbstractXSLTLiaisonTest { | |||||
| public AdaptxLiaisonTest(String name){ | |||||
| super(name); | |||||
| } | |||||
| protected XSLTLiaison createLiaison() throws Exception { | |||||
| return new AdaptxLiaison(); | |||||
| } | |||||
| } | |||||