cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl XSLTAspect.java
Date Sun, 25 Apr 2004 20:12:04 GMT
haul        2004/04/25 13:12:04

  Modified:    src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl
                        XSLTAspect.java
  Log:
  work on javadocs
  pass parameters directly to stylesheet (eliminates the necessity to use the parameter aspect)
  
  Revision  Changes    Path
  1.10      +29 -1     cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/XSLTAspect.java
  
  Index: XSLTAspect.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/XSLTAspect.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XSLTAspect.java	5 Mar 2004 13:02:13 -0000	1.9
  +++ XSLTAspect.java	25 Apr 2004 20:12:04 -0000	1.10
  @@ -19,7 +19,9 @@
   import java.util.ArrayList;
   import java.util.Iterator;
   import java.util.List;
  +import java.util.Map;
   
  +import javax.xml.transform.Transformer;
   import javax.xml.transform.sax.SAXResult;
   import javax.xml.transform.sax.TransformerHandler;
   
  @@ -44,6 +46,23 @@
   import org.xml.sax.ext.LexicalHandler;
   
   /**
  + * Apply a XSLT stylesheet to the contained layout. All following renderer aspects
  + * are applied first before the XML is fed into the XSLT. All layout parameters
  + * are made available to the stylesheet.
  + * 
  + * <h2>Example XML:</h2>
  + * <pre>
  + *  &lt;-- result from output of following renderers transformed by stylesheet --&gt;
  + * </pre>
  + *
  + * <h2>Applicable to:</h2>
  + * {@link org.apache.cocoon.portal.layout.Layout}
  + *
  + * <h2>Parameters</h2>
  + * <table><tbody>
  + * <tr><th>style</th><td></td><td>req</td><td>String</td><td><code>null</code></td></tr>
  + * <tr><th>xslt-processor-role</th><td></td><td>req</td><td>String</td><td><code>null</code></td></tr>
  + * </tbody></table>  
    *
    * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
    * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
  @@ -84,6 +103,15 @@
               stylesheet = resolver.resolveURI(this.getStylesheetURI(config, layout));
               processor = (XSLTProcessor) this.manager.lookup(config.xsltRole);
               TransformerHandler transformer = processor.getTransformerHandler(stylesheet);
  +            Map parameter = layout.getParameters();
  +            if (parameter.size() > 0) {
  +                Map.Entry entry;
  +                Transformer theTransformer = transformer.getTransformer();
  +                for (Iterator iter = parameter.entrySet().iterator(); iter.hasNext();)
{
  +                    entry = (Map.Entry) iter.next();
  +                    theTransformer.setParameter((String)entry.getKey(), entry.getValue());
  +                }
  +            }
               SAXResult result = new SAXResult(new IncludeXMLConsumer((handler)));
               if (handler instanceof LexicalHandler) {
                   result.setLexicalHandler((LexicalHandler) handler);
  
  
  

Mime
View raw message