diff --git a/src/main/org/apache/tools/ant/taskdefs/XSLTLiaison2.java b/src/main/org/apache/tools/ant/taskdefs/XSLTLiaison2.java
new file mode 100644
index 000000000..f9cb79dd6
--- /dev/null
+++ b/src/main/org/apache/tools/ant/taskdefs/XSLTLiaison2.java
@@ -0,0 +1,69 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000-2002 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 "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;
+
+/**
+ * Extended Proxy interface for XSLT processors.
+ *
+ * @author Conro MacNeill
+ * @see XSLTProcess
+ * @since Ant 1.6
+ */
+public interface XSLTLiaison2 extends XSLTLiaison {
+ /**
+ * Configure the liasion from the XSLTProcess task
+ */
+ void configure(XSLTProcess xsltTask);
+}
diff --git a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
index 5b251cac3..496c6154b 100644
--- a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
+++ b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
@@ -62,7 +62,6 @@ 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.taskdefs.optional.TraXLiaison;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.types.XMLCatalog;
@@ -558,6 +557,29 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
}
}
+ /**
+ * Get the factory instance configured for this processor
+ *
+ * @return the factory instance in use
+ */
+ public Factory getFactory() {
+ return factory;
+ }
+
+ /**
+ * Get the XML catalog containing entity definitions
+ *
+ * @return the XML catalog for the task.
+ */
+ public XMLCatalog getXMLCatalog() {
+ return xmlCatalog;
+ }
+
+ public Enumeration getOutputProperties() {
+ return outputProperties.elements();
+ }
+
+
/**
* Get the Liason implementation to use in processing.
*
@@ -793,48 +815,16 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
liaison.addParam(p.getName(), p.getExpression());
}
}
- if (liaison instanceof TraXLiaison) {
- configureTraXLiaison((TraXLiaison) liaison);
+ if (liaison instanceof XSLTLiaison2) {
+ ((XSLTLiaison2) liaison).configure(this);
}
} catch (Exception ex) {
- log("Failed to transform using stylesheet " + stylesheet, Project.MSG_INFO);
+ log("Failed to transform using stylesheet " + stylesheet,
+ Project.MSG_INFO);
throw new BuildException(ex);
}
}
- /**
- * Specific configuration for the TRaX liaison. Support for
- * all others has been dropped so this liaison will soon look
- * like the exact copy of JAXP interface..
- * @param liaison the TRaXLiaison to configure.
- */
- protected void configureTraXLiaison(TraXLiaison liaison) {
- if (factory != null) {
- liaison.setFactory(factory.getName());
-
- // configure factory attributes
- for (Enumeration attrs = factory.getAttributes();
- attrs.hasMoreElements();) {
- Factory.Attribute attr =
- (Factory.Attribute) attrs.nextElement();
- liaison.setAttribute(attr.getName(), attr.getValue());
- }
- }
-
- // use XMLCatalog as the entity resolver and URI resolver
- if (xmlCatalog != null) {
- liaison.setEntityResolver(xmlCatalog);
- liaison.setURIResolver(xmlCatalog);
- }
-
- // configure output properties
- for (Enumeration props = outputProperties.elements();
- props.hasMoreElements();) {
- OutputProperty prop = (OutputProperty) props.nextElement();
- liaison.setOutputProperty(prop.getName(), prop.getValue());
- }
- }
-
/**
* Create the factory element to configure a trax liaison.
* @return the newly created factory element.
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java b/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
index 8b60d0ab8..c213eec93 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
@@ -63,6 +63,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Vector;
+import java.util.Enumeration;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.ErrorListener;
import javax.xml.transform.Source;
@@ -77,9 +78,11 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.TransformerConfigurationException;
import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.XSLTLiaison;
+import org.apache.tools.ant.taskdefs.XSLTLiaison2;
+import org.apache.tools.ant.taskdefs.XSLTProcess;
import org.apache.tools.ant.taskdefs.XSLTLogger;
import org.apache.tools.ant.taskdefs.XSLTLoggerAware;
+import org.apache.tools.ant.types.XMLCatalog;
import org.apache.tools.ant.util.JAXPUtils;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
@@ -93,7 +96,7 @@ import org.xml.sax.XMLReader;
* @author Stephane Bailliez
* @since Ant 1.3
*/
-public class TraXLiaison implements XSLTLiaison, ErrorListener, XSLTLoggerAware {
+public class TraXLiaison implements XSLTLiaison2, ErrorListener, XSLTLoggerAware {
/**
* the name of the factory implementation class to use
@@ -430,4 +433,40 @@ public class TraXLiaison implements XSLTLiaison, ErrorListener, XSLTLoggerAware
return JAXPUtils.getSystemId(file);
}
-} //-- TraXLiaison
+
+ /**
+ * Specific configuration for the TRaX liaison.
+ * @param xsltTask the XSLTProcess task instance from which this liasion
+ * is to be configured.
+ */
+ public void configure(XSLTProcess xsltTask) {
+ XSLTProcess.Factory factory = xsltTask.getFactory();
+ if (factory != null) {
+ setFactory(factory.getName());
+
+ // configure factory attributes
+ for (Enumeration attrs = factory.getAttributes();
+ attrs.hasMoreElements();) {
+ XSLTProcess.Factory.Attribute attr =
+ (XSLTProcess.Factory.Attribute) attrs.nextElement();
+ setAttribute(attr.getName(), attr.getValue());
+ }
+ }
+
+ XMLCatalog xmlCatalog = xsltTask.getXMLCatalog();
+ // use XMLCatalog as the entity resolver and URI resolver
+ if (xmlCatalog != null) {
+ setEntityResolver(xmlCatalog);
+ setURIResolver(xmlCatalog);
+ }
+
+
+ // configure output properties
+ for (Enumeration props = xsltTask.getOutputProperties();
+ props.hasMoreElements();) {
+ XSLTProcess.OutputProperty prop
+ = (XSLTProcess.OutputProperty) props.nextElement();
+ setOutputProperty(prop.getName(), prop.getValue());
+ }
+ }
+}