cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@locus.apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/transformer Transformer.java XalanTransformer.java XTTransformer.java
Date Sat, 04 Mar 2000 02:36:01 GMT
stefano     00/03/03 18:36:01

  Modified:    src/org/apache/cocoon/transformer Transformer.java
                        XalanTransformer.java XTTransformer.java
  Log:
  allowed parameters to be passed to the transformers... currently XT doesn't implement this
(feel free to patch if you need it)
  
  Revision  Changes    Path
  1.4       +16 -16    xml-cocoon/src/org/apache/cocoon/transformer/Transformer.java
  
  Index: Transformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformer/Transformer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Transformer.java	2000/02/13 18:29:42	1.3
  +++ Transformer.java	2000/03/04 02:36:00	1.4
  @@ -1,36 +1,36 @@
  -/*-- $Id: Transformer.java,v 1.3 2000/02/13 18:29:42 stefano Exp $ -- 
  +/*-- $Id: Transformer.java,v 1.4 2000/03/04 02:36:00 stefano Exp $ --
   
    ============================================================================
                      The Apache Software License, Version 1.1
    ============================================================================
  - 
  +
    Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
  - 
  +
    Redistribution and use in source and binary forms, with or without modifica-
    tion, 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  acknowledgment:  "This product includes  software
       developed  by the  Apache Software Foundation  (http://www.apache.org/)."
       Alternately, this  acknowledgment may  appear in the software itself,  if
       and wherever such third-party acknowledgments normally appear.
  - 
  +
    4. The names "Cocoon" 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 name,  without prior written permission  of the
       Apache Software Foundation.
  - 
  +
    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
  @@ -41,12 +41,12 @@
    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 and was  originally created by
  - Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache 
  + Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache
    Software Foundation, please see <http://www.apache.org/>.
  - 
  +
    */
   package org.apache.cocoon.transformer;
   
  @@ -58,7 +58,7 @@
    * This interface is implemented by all XSLT tranformers.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.3 $ $Date: 2000/02/13 18:29:42 $
  + * @version $Revision: 1.4 $ $Date: 2000/03/04 02:36:00 $
    */
   
   public interface Transformer extends Actor {
  @@ -67,8 +67,8 @@
        * Process the DOM tree with the given transformation sheet and
        * uses the result tree to return.
        */
  -    public Document transform(Document document, String documentBase, 
  -                              Document sheet, String sheetBase, 
  -                              Document result) throws Exception;
  +    public Document transform(Document document, String documentBase,
  +                              Document sheet, String sheetBase,
  +                              Document result, Hashtable parameters) throws Exception;
   
   }
  
  
  
  1.9       +15 -9     xml-cocoon/src/org/apache/cocoon/transformer/XalanTransformer.java
  
  Index: XalanTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformer/XalanTransformer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XalanTransformer.java	2000/02/23 00:49:06	1.8
  +++ XalanTransformer.java	2000/03/04 02:36:00	1.9
  @@ -1,4 +1,4 @@
  -/*-- $Id: XalanTransformer.java,v 1.8 2000/02/23 00:49:06 stefano Exp $ --
  +/*-- $Id: XalanTransformer.java,v 1.9 2000/03/04 02:36:00 stefano Exp $ --
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -69,23 +69,29 @@
    * Xalan XSLT processor.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.8 $ $Date: 2000/02/23 00:49:06 $
  + * @version $Revision: 1.9 $ $Date: 2000/03/04 02:36:00 $
    */
   
   public class XalanTransformer extends AbstractActor implements Transformer, Status {
   
  -    XSLTProcessor processor;
  +    Parser parser;
   
       public void init(Director director) {
           super.init(director);
  -        this.processor = XSLTProcessorFactory.getProcessor(
  -            new XMLParser(
  -                (Parser) director.getActor("parser")
  -            )
  -        );
  +        this.parser = (Parser) director.getActor("parser");
       }
   
  -    public Document transform(Document in, String inBase, Document sheet, String sheetBase,
Document out) throws Exception {
  +    public Document transform(Document in, String inBase, Document sheet,
  +        String sheetBase, Document out, Hashtable params)
  +    throws Exception {
  +        XSLTProcessor processor = XSLTProcessorFactory.getProcessor(new XMLParser(parser));
  +
  +        Enumeration enum = params.keys();
  +        while (enum.hasMoreElements()) {
  +            String name = (String) enum.nextElement();
  +            processor.setStylesheetParam(name, processor.createXString((String) params.get(name)));
  +        }
  +
           XSLTInputSource i = new XSLTInputSource(in);
           // inBase not used for now (external entities are already included at parse time)
           XSLTInputSource s = new XSLTInputSource(sheet);
  
  
  
  1.5       +15 -13    xml-cocoon/src/org/apache/cocoon/transformer/XTTransformer.java
  
  Index: XTTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformer/XTTransformer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XTTransformer.java	2000/02/13 18:29:42	1.4
  +++ XTTransformer.java	2000/03/04 02:36:00	1.5
  @@ -1,36 +1,36 @@
  -/*-- $Id: XTTransformer.java,v 1.4 2000/02/13 18:29:42 stefano Exp $ -- 
  +/*-- $Id: XTTransformer.java,v 1.5 2000/03/04 02:36:00 stefano Exp $ --
   
    ============================================================================
                      The Apache Software License, Version 1.1
    ============================================================================
  - 
  +
    Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
  - 
  +
    Redistribution and use in source and binary forms, with or without modifica-
    tion, 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  acknowledgment:  "This product includes  software
       developed  by the  Apache Software Foundation  (http://www.apache.org/)."
       Alternately, this  acknowledgment may  appear in the software itself,  if
       and wherever such third-party acknowledgments normally appear.
  - 
  +
    4. The names "Cocoon" 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 name,  without prior written permission  of the
       Apache Software Foundation.
  - 
  +
    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
  @@ -41,12 +41,12 @@
    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 and was  originally created by
  - Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache 
  + Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache
    Software Foundation, please see <http://www.apache.org/>.
  - 
  +
    */
   package org.apache.cocoon.transformer;
   
  @@ -75,7 +75,9 @@
   
   public class XTTransformer extends AbstractActor implements Transformer, Status {
   
  -    public Document transform(Document document, String documentBase, Document sheet, String
sheetBase, Document result) throws Exception {
  +    public Document transform(Document document, String documentBase,
  +        Document sheet, String sheetBase, Document result, Hashtable params)
  +    throws Exception {
           Transform transformer = new XSLTransformEngine().createTransform(sheet);
           transformer.transform(document, result);
           return result;
  
  
  

Mime
View raw message