ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional AdaptxLiaison.java TraXLiaison.java XalanLiaison.java XslpLiaison.java
Date Mon, 26 Nov 2001 18:10:46 GMT
rubys       01/11/26 10:10:46

  Modified:    docs/manual/CoreTasks style.html
               src/main/org/apache/tools/ant/taskdefs XSLTLiaison.java
                        XSLTProcess.java
               src/main/org/apache/tools/ant/taskdefs/optional
                        AdaptxLiaison.java TraXLiaison.java
                        XalanLiaison.java XslpLiaison.java
  Log:
  Add support to for XSLT output types.  This maps to TraX's:
     transformer.setOutputProperty(OutputKeys.METHOD, type);
  
  Background/rationalle: I'm looking into spliting Gumps gen.bat and gen.sh
  scripts into a minimal bootstrap and a normal Ant "build.xml".  In order
  to achieve this, I need access to the functionallity that Xalan supports
  from the command line via the -text parameter.
  
  I've provided an implementation to seed the discussion on how this should
  be supported.  I am by no means wedded to this approach - if others see a
  better way, either let me know or directly make the change.
  
  Revision  Changes    Path
  1.13      +7 -0      jakarta-ant/docs/manual/CoreTasks/style.html
  
  Index: style.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/style.html,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- style.html	2001/11/25 16:32:51	1.12
  +++ style.html	2001/11/26 18:10:45	1.13
  @@ -140,6 +140,13 @@
         in attribute.</td>
       <td valign="top" align="center">No</td>
     </tr>
  +  <tr>
  +    <td valign="top">outputtype</td>
  +    <td valign="top">specifies the output method to be used.  Only "xml" is
  +      guaranteed to be supported by all translators.  Xalan2 supports "xml",
  +      "html", and "text"</td>
  +    <td valign="top" align="center">No</td>
  +  </tr>
   </table>
   <h3>Parameters specified as nested elements</h3>
   <h4>classpath</h4>
  
  
  
  1.7       +8 -0      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/XSLTLiaison.java
  
  Index: XSLTLiaison.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/XSLTLiaison.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XSLTLiaison.java	2001/11/06 11:08:34	1.6
  +++ XSLTLiaison.java	2001/11/26 18:10:45	1.7
  @@ -93,6 +93,14 @@
       void addParam(String name, String expression) throws Exception;
   
       /**
  +     * set the output type to use for the transformation.  Only "xml" (the
  +     * default) is guaranteed to work for all parsers.  Xalan2 also
  +     * supports "html" and "text".
  +     * @param type the output method to use
  +     */
  +    void setOutputtype(String type) throws Exception;
  +
  +    /**
        * Perform the transformation of a file into another.
        * @param infile the input file, probably an XML one. :-)
        * @param outfile the output file resulting from the transformation
  
  
  
  1.29      +12 -0     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
  
  Index: XSLTProcess.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- XSLTProcess.java	2001/11/26 03:09:01	1.28
  +++ XSLTProcess.java	2001/11/26 18:10:45	1.29
  @@ -116,6 +116,8 @@
   
       private FileUtils fileUtils;
   
  +    private String outputtype = null;
  +
       /**
        * Creates a new XSLTProcess Task.
        **/
  @@ -455,6 +457,16 @@
               if(expression==null)throw new BuildException("Expression attribute is missing.");
               return expression;
           }
  +    }
  +
  +    /**
  +     * Set the output type to use for the transformation.  Only "xml" (the
  +     * default) is guaranteed to work for all parsers.  Xalan2 also
  +     * supports "html" and "text".
  +     * @param type the output method to use
  +     */
  +    public void setOutputtype(String type) {
  +        this.outputtype = type;
       }
   
       /**
  
  
  
  1.2       +7 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/AdaptxLiaison.java
  
  Index: AdaptxLiaison.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/AdaptxLiaison.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AdaptxLiaison.java	2001/10/29 11:16:49	1.1
  +++ AdaptxLiaison.java	2001/11/26 18:10:45	1.2
  @@ -59,6 +59,7 @@
   import java.io.OutputStreamWriter;
   
   import org.apache.tools.ant.taskdefs.XSLTLiaison;
  +import org.apache.tools.ant.BuildException;
   
   import org.exolab.adaptx.xslt.XSLTProcessor;
   import org.exolab.adaptx.xslt.XSLTReader;
  @@ -67,7 +68,7 @@
   /**
    *
    * @author <a href="mailto:blandin@intalio.com">Arnaud Blandin</a>
  - * @version $Revision: 1.1 $ $Date: 2001/10/29 11:16:49 $
  + * @version $Revision: 1.2 $ $Date: 2001/11/26 18:10:45 $
    */
   public class AdaptxLiaison implements XSLTLiaison {
   
  @@ -91,6 +92,11 @@
   
       public void addParam(String name, String expression){
           processor.setProperty(name, expression);
  +    }
  +
  +    public void setOutputtype(String type) throws Exception {
  +        if (!type.equals("xml")) 
  +            throw new BuildException("Unsupported output type: " + type);
       }
   
   } //-- AdaptxLiaison
  
  
  
  1.6       +5 -0      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
  
  Index: TraXLiaison.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TraXLiaison.java	2001/10/28 21:30:18	1.5
  +++ TraXLiaison.java	2001/11/26 18:10:45	1.6
  @@ -67,6 +67,7 @@
   
   import javax.xml.transform.stream.StreamResult;
   import javax.xml.transform.stream.StreamSource;
  +import javax.xml.transform.OutputKeys;
   
   /**
    * Concrete liaison for XSLT processor implementing TraX. (ie JAXP 1.1)
  @@ -159,5 +160,9 @@
   
       public void addParam(String name, String value){
           transformer.setParameter(name, value);
  +    }
  +
  +    public void setOutputtype(String type) throws Exception {
  +        transformer.setOutputProperty(OutputKeys.METHOD, type);
       }
   } //-- TraXLiaison
  
  
  
  1.8       +6 -0      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/XalanLiaison.java
  
  Index: XalanLiaison.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/XalanLiaison.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XalanLiaison.java	2001/10/28 21:30:18	1.7
  +++ XalanLiaison.java	2001/11/26 18:10:45	1.8
  @@ -54,6 +54,7 @@
   
   package org.apache.tools.ant.taskdefs.optional;
   
  +import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.taskdefs.XSLTLiaison;
   
   import org.apache.xalan.xslt.XSLTProcessorFactory;
  @@ -126,5 +127,10 @@
   
       public void addParam(String name, String value){
           processor.setStylesheetParam(name, value);
  +    }
  +
  +    public void setOutputtype(String type) throws Exception {
  +        if (!type.equals("xml")) 
  +            throw new BuildException("Unsupported output type: " + type);
       }
   } //-- XalanLiaison
  
  
  
  1.9       +6 -0      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/XslpLiaison.java
  
  Index: XslpLiaison.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/XslpLiaison.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XslpLiaison.java	2001/10/29 14:24:51	1.8
  +++ XslpLiaison.java	2001/11/26 18:10:45	1.9
  @@ -58,6 +58,7 @@
   import com.kvisco.xsl.XSLReader;
   import com.kvisco.xsl.XSLStylesheet;
   import org.apache.tools.ant.taskdefs.XSLTLiaison;
  +import org.apache.tools.ant.BuildException;
   
   import java.io.File;
   import java.io.FileOutputStream;
  @@ -101,6 +102,11 @@
   
       public void addParam(String name, String expression){
         processor.setProperty(name, expression);
  +    }
  +
  +    public void setOutputtype(String type) throws Exception {
  +        if (!type.equals("xml")) 
  +            throw new BuildException("Unsupported output type: " + type);
       }
   
   } //-- XSLPLiaison
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message