cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: cocoon-2.1/src/webapp/WEB-INF cocoon.xconf
Date Sat, 19 Apr 2003 20:38:22 GMT
cziegeler    2003/04/19 13:38:22

  Modified:    src/java/org/apache/cocoon/transformation
                        TraxTransformer.java
               src/webapp sitemap.xmap
               src/documentation sitemap.xmap cocoon.xconf
               src/webapp/WEB-INF cocoon.xconf
  Log:
  Readding xslt-processor-role to TraxTransformer
  
  Revision  Changes    Path
  1.3       +41 -36    cocoon-2.1/src/java/org/apache/cocoon/transformation/TraxTransformer.java
  
  Index: TraxTransformer.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/transformation/TraxTransformer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TraxTransformer.java	19 Mar 2003 15:42:14 -0000	1.2
  +++ TraxTransformer.java	19 Apr 2003 20:38:22 -0000	1.3
  @@ -50,8 +50,16 @@
   
   package org.apache.cocoon.transformation;
   
  -import org.apache.excalibur.xml.xslt.XSLTProcessor;
  -import org.apache.excalibur.xml.xslt.XSLTProcessorException;
  +import java.io.IOException;
  +import java.util.Enumeration;
  +import java.util.HashMap;
  +import java.util.Iterator;
  +import java.util.Map;
  +import java.util.Set;
  +
  +import javax.xml.transform.sax.SAXResult;
  +import javax.xml.transform.sax.TransformerHandler;
  +
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
  @@ -73,21 +81,13 @@
   import org.apache.excalibur.source.Source;
   import org.apache.excalibur.source.SourceException;
   import org.apache.excalibur.source.SourceValidity;
  +import org.apache.excalibur.xml.xslt.XSLTProcessor;
  +import org.apache.excalibur.xml.xslt.XSLTProcessorException;
   import org.xml.sax.SAXException;
   
  -import javax.xml.transform.sax.SAXResult;
  -import javax.xml.transform.sax.TransformerHandler;
  -
  -import java.io.IOException;
  -import java.util.Enumeration;
  -import java.util.HashMap;
  -import java.util.Iterator;
  -import java.util.Map;
  -import java.util.Set;
  -
   /**
  - * This Transformer is used to transform this incoming SAX stream using
  - * a XSLT stylesheet. Use the following sitemap declarations to define, configure
  + * This Transformer is used to transform the incoming SAX stream using
  + * a TrAXProcessor. Use the following sitemap declarations to define, configure
    * and parameterize it:
    *
    * <b>In the map:sitemap/map:components/map:transformers:</b><br>
  @@ -96,6 +96,7 @@
    *   &lt;use-request-parameters&gt;false&lt;/use-request-parameters&gt;
    *   &lt;use-browser-capabilities-db&gt;false&lt;/use-browser-capabilities-db&gt;
    *   &lt;use-session-info&gt;false&lt;/use-session-info&gt;
  + *   &lt;xslt-processor&gt;xslt&lt;/xslt-processor&gt;
    *   &lt;transformer-factory&gt;org.apache.xalan.processor.TransformerFactoryImpl&lt;/transformer-factory&gt;
    * &lt;/map:transformer&gt;
    * </pre>
  @@ -121,13 +122,17 @@
    * cacheability of the generated output of this transformer.<br>
    *
    *
  - * The &lt;transformer-factory&gt; configuration allows to specify the TrAX transformer
factory
  - * implementation that willbe used to obtain the XSLT processor. This allows to have
  - * several XSLT processors in the configuration
  - * (e.g. Xalan, XSTLC, Saxon, ...) and choose one or the other depending on the needs of
stylesheet
  - * specificities.<br>
  - * If no factory is specified, this transformer will use the XSLT implementation
  + * The &lt;xslt-processor-role&gt; configuration allows to specify the TrAX processor
(defined in
  + * the cocoon.xconf) that will be used to obtain the XSLT processor. This allows to have
  + * several XSLT processors in the configuration (e.g. Xalan, XSTLC, Saxon, ...) and choose

  + * one or the other depending on the needs of stylesheet specificities.<br>
  + * If no processor is specified, this transformer will use the XSLT implementation
    * that Cocoon uses internally.
  + * 
  + * The &lt;transformer-factory&gt; configuration allows to specify the TrAX transformer
factory
  + * implementation that will be used to obtain the XSLT processor. This is only usefull
for
  + * compatibility reasons. Please configure the xslt processor in the cocoon.xconf properly
  + * and use the xslt-processor-role configuration mentioned above.
    *
    * <p>
    * <b>In a map:sitemap/map:pipelines/map:pipeline:</b><br>
  @@ -172,9 +177,6 @@
       private boolean useSessionInfo = false;
       private boolean _useSessionInfo = false;
   
  -    /** The trax TransformerFactory classname */
  -    private String traxFactory;
  -
       /** The trax TransformerHandler */
       TransformerHandler transformerHandler;
   
  @@ -214,28 +216,31 @@
           this._useSessionInfo = this.useSessionInfo;
   
           child = conf.getChild("transformer-factory");
  -
           // traxFactory is null, if transformer-factory config is unspecified
  -        this.traxFactory = child.getValue(null);
  +        final String traxFactory = child.getValue(null);
   
  +        child = conf.getChild("xslt-processor-role");
  +        String xsltProcessorRole = child.getValue(XSLTProcessor.ROLE);
  +        if (!xsltProcessorRole.startsWith(XSLTProcessor.ROLE)) {
  +            xsltProcessorRole = XSLTProcessor.ROLE + '/' + xsltProcessorRole;
  +        }
           if (this.getLogger().isDebugEnabled()) {
  -            this.getLogger().debug("Use parameters is " + this.useParameters + " for "
+ this);
  -            this.getLogger().debug("Use cookies is " + this.useCookies + " for " + this);
  -            this.getLogger().debug("Use session info is " + this.useSessionInfo + " for
" + this);
  +            this.getLogger().debug("Use parameters is " + this.useParameters);
  +            this.getLogger().debug("Use cookies is " + this.useCookies);
  +            this.getLogger().debug("Use session info is " + this.useSessionInfo);
  +            this.getLogger().debug("Use TrAX Processor " + xsltProcessorRole);
   
  -            if (this.traxFactory != null) {
  -                this.getLogger().debug("Use TrAX Transformer Factory " + this.traxFactory);
  +            if (traxFactory != null) {
  +                this.getLogger().debug("Use TrAX Transformer Factory " + traxFactory);
               } else {
                   this.getLogger().debug("Use default TrAX Transformer Factory.");
               }
           }
   
           try {
  -            this.xsltProcessor = (XSLTProcessor) this.manager.lookup(XSLTProcessor.ROLE);
  -            // override xsltProcessor setting only, in case of
  -            // transformer-factory config is specified
  -            if (this.traxFactory != null) {
  -                this.xsltProcessor.setTransformerFactory(this.traxFactory);
  +            this.xsltProcessor = (XSLTProcessor) this.manager.lookup(xsltProcessorRole);
  +            if (traxFactory != null) {
  +                this.xsltProcessor.setTransformerFactory(traxFactory);
               }
           } catch (ComponentException e) {
               throw new ConfigurationException("Cannot load XSLT processor", e);
  
  
  
  1.11      +3 -12     cocoon-2.1/src/webapp/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/webapp/sitemap.xmap,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- sitemap.xmap	1 Apr 2003 21:25:10 -0000	1.10
  +++ sitemap.xmap	19 Apr 2003 20:38:22 -0000	1.11
  @@ -78,16 +78,7 @@
         <use-request-parameters>false</use-request-parameters>
         <use-session-parameters>false</use-session-parameters>
         <use-cookie-parameters>false</use-cookie-parameters>
  -      <transformer-factory>org.apache.xalan.xsltc.trax.TransformerFactoryImpl</transformer-factory>
  -      <!--
  -        Interpreted Xalan
  -      <transformer-factory>org.apache.xalan.processor.TransformerFactoryImpl</transformer-factory>
  -        Old (6.5.2) Saxon:
  -      <transformer-factory>com.icl.saxon.TransformerFactoryImpl</transformer-factory>
  -        New (7.x?) Saxon: 
  -      <transformer-factory>net.sf.saxon.TransformerFactoryImpl</transformer-factory>
  -       -->
  -
  +      <xslt-processor-role>xsltc</xslt-processor-role>
       </map:transformer>
   
       <!-- NOTE: This used to be the default XSLT processor. The default now is XSLTC
-->
  @@ -95,7 +86,7 @@
         <use-request-parameters>false</use-request-parameters>
         <use-session-parameters>false</use-session-parameters>
         <use-cookie-parameters>false</use-cookie-parameters>
  -      <transformer-factory>org.apache.xalan.processor.TransformerFactoryImpl</transformer-factory>
  +      <xslt-processor-role>xalan</xslt-processor-role>
       </map:transformer>
   
       <map:transformer logger="sitemap.transformer.xinclude" name="xinclude" pool-grow="2"
pool-max="16" pool-min="2" src="org.apache.cocoon.transformation.XIncludeTransformer"/>
  
  
  
  1.6       +1 -3      cocoon-2.1/src/documentation/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/documentation/sitemap.xmap,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- sitemap.xmap	26 Mar 2003 13:28:00 -0000	1.5
  +++ sitemap.xmap	19 Apr 2003 20:38:22 -0000	1.6
  @@ -39,9 +39,7 @@
           <use-request-parameters>false</use-request-parameters>
           <use-browser-capabilities-db>false</use-browser-capabilities-db>
           <use-deli>false</use-deli>
  -        <transformer-factory>org.apache.xalan.processor.TransformerFactoryImpl</transformer-factory>
  -        <!--<transformer-factory>com.icl.saxon.TransformerFactoryImpl</transformer-factory>-->
  -        <!--<transformer-factory>org.apache.xalan.xsltc.trax.TransformerFactoryImpl</transformer-factory>-->
  +        <xslt-processor-role>xalan</xslt-processor-role>
         </map:transformer>
   
         <map:transformer name="xinclude" src="org.apache.cocoon.transformation.XIncludeTransformer"
logger="sitemap.transformer.xinclude" pool-grow="2" pool-max="16" pool-min="2" />
  
  
  
  1.6       +22 -0     cocoon-2.1/src/documentation/cocoon.xconf
  
  Index: cocoon.xconf
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/documentation/cocoon.xconf,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- cocoon.xconf	18 Mar 2003 05:49:00 -0000	1.5
  +++ cocoon.xconf	19 Apr 2003 20:38:22 -0000	1.6
  @@ -44,6 +44,28 @@
        <parameter name="use-store" value="true"/> 
     </xslt-processor>
   
  +  <!--+
  +      | XSLT Processor using xsltc from Xalan
  +      | For Interpreted Xalan use:
  +      | <transformer-factory>org.apache.xalan.processor.TransformerFactoryImpl</transformer-factory>
  +      +-->
  +  <component-instance logger="core.xslt-processor"
  +                      role="org.apache.excalibur.xml.xslt.XSLTProcessor/xsltc"
  +                      class="org.apache.excalibur.xml.xslt.XSLTProcessorImpl">
  +     <parameter name="use-store" value="false"/>
  +     <parameter name="transformer-factory" value="org.apache.xalan.xsltc.trax.TransformerFactoryImpl"/>
  +  </component-instance>
  +  
  +  <!--+
  +      | Xalan XSLT Processor
  +      +-->
  +  <component-instance logger="core.xslt-processor"
  +                      role="org.apache.excalibur.xml.xslt.XSLTProcessor/xalan"
  +                      class="org.apache.excalibur.xml.xslt.XSLTProcessorImpl">
  +     <parameter name="use-store" value="false"/>
  +     <parameter name="transformer-factory" value="org.apache.xalan.processor.TransformerFactoryImpl"/>
  +  </component-instance>
  +
     <!-- Source Factories -->
     <source-factories>
       <component-instance class="org.apache.excalibur.source.impl.ResourceSourceFactory"
name="resource"/>
  
  
  
  1.13      +38 -0     cocoon-2.1/src/webapp/WEB-INF/cocoon.xconf
  
  Index: cocoon.xconf
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/webapp/WEB-INF/cocoon.xconf,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- cocoon.xconf	4 Apr 2003 17:14:33 -0000	1.12
  +++ cocoon.xconf	19 Apr 2003 20:38:22 -0000	1.13
  @@ -332,6 +332,44 @@
        <parameter name="incremental-processing" value="true"/>
     </xslt-processor>
   
  +  <!--+
  +      | XSLT Processor using xsltc from Xalan
  +      | For Interpreted Xalan use:
  +      | <transformer-factory>org.apache.xalan.processor.TransformerFactoryImpl</transformer-factory>
  +      +-->
  +  <component-instance logger="core.xslt-processor"
  +                      role="org.apache.excalibur.xml.xslt.XSLTProcessor/xsltc"
  +                      class="org.apache.excalibur.xml.xslt.XSLTProcessorImpl">
  +     <parameter name="use-store" value="false"/>
  +     <parameter name="incremental-processing" value="true"/>
  +     <parameter name="transformer-factory" value="org.apache.xalan.xsltc.trax.TransformerFactoryImpl"/>
  +  </component-instance>
  +  
  +  <!--+
  +      | Xalan XSLT Processor
  +      +-->
  +  <component-instance logger="core.xslt-processor"
  +                      role="org.apache.excalibur.xml.xslt.XSLTProcessor/xalan"
  +                      class="org.apache.excalibur.xml.xslt.XSLTProcessorImpl">
  +     <parameter name="use-store" value="false"/>
  +     <parameter name="incremental-processing" value="true"/>
  +     <parameter name="transformer-factory" value="org.apache.xalan.processor.TransformerFactoryImpl"/>
  +  </component-instance>
  +
  +  <!--+
  +      | Saxon XSLT Processor
  +      | For old (6.5.2) Saxon use:
  +      |  <parameter name="transformer-factory" value="com.icl.saxon.TransformerFactoryImpl"/>
  +      | For new (7.x?) Saxon use:
  +      |  <parameter name="transformer-factory" value="net.sf.saxon.TransformerFactoryImpl"/>
  +  <component-instance logger="core.xslt-processor"
  +                      role="org.apache.excalibur.xml.xslt.XSLTProcessor/saxon"
  +                      class="org.apache.excalibur.xml.xslt.XSLTProcessorImpl">
  +     <parameter name="use-store" value="false"/>
  +     <parameter name="transformer-factory" value="com.icl.saxon.TransformerFactoryImpl"/>
  +  </component-instance>
  +  +-->
  +
     <!-- Xpath Processor: -->
     <xpath-processor class="org.apache.excalibur.xml.xpath.XPathProcessorImpl" logger="core.xpath-processor"/>
   
  
  
  

Mime
View raw message