org.apache.cocoon.portal.layout.renderer.aspect.impl
Class XSLTAspect

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.cocoon.portal.layout.renderer.aspect.impl.AbstractAspect
          extended byorg.apache.cocoon.portal.layout.renderer.aspect.impl.XSLTAspect
All Implemented Interfaces:
Configurable, Disposable, LogEnabled, RendererAspect, Serviceable, ThreadSafe

public class XSLTAspect
extends AbstractAspect
implements Disposable, Configurable

Apply a XSLT stylesheet to the contained layout. All following renderer aspects are applied first before the XML is fed into the XSLT. All configuration and layout parameters are made available to the stylesheet.

Example XML:

  <-- result from output of following renderers transformed by stylesheet -->
 
The parameter values may contain Strings and/or references to input modules which will be resolved each time the aspect is rendered.

Applicable to:

Layout

Configuration

cocoon.xconf

 <aspect name="xslt" class="org.apache.cocoon.portal.layout.renderer.aspect.impl.XSLTAspect">
   <parameters>
     <parameter name="name1" value="parameter value"/>
     <parameter name="name2" value="parameter value"/>
   <parameter>
 </aspect>
 

Parameters

stylereqStringnull
xslt-processor-rolereqStringnull

Version:
$Id: XSLTAspect.java 322471 2005-10-16 13:24:19Z cziegeler $

Nested Class Summary
protected static class XSLTAspect.PreparedConfiguration
           
 
Field Summary
protected  Parameters parameters
           
protected  List variables
           
 
Fields inherited from class org.apache.cocoon.portal.layout.renderer.aspect.impl.AbstractAspect
manager
 
Fields inherited from interface org.apache.cocoon.portal.layout.renderer.aspect.RendererAspect
ROLE
 
Constructor Summary
XSLTAspect()
           
 
Method Summary
 void configure(Configuration config)
           
 void dispose()
           
protected  String getParameterValue(Map.Entry entry)
           
protected  String getStylesheetURI(XSLTAspect.PreparedConfiguration config, Layout layout)
           
 Object prepareConfiguration(Parameters configuration)
          Compile the configuration.
 void service(ServiceManager manager)
           
 void toSAX(RendererAspectContext context, Layout layout, PortalService service, ContentHandler handler)
          Stream out raw layout
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

variables

protected List variables

parameters

protected Parameters parameters
Constructor Detail

XSLTAspect

public XSLTAspect()
Method Detail

service

public void service(ServiceManager manager)
             throws ServiceException
Specified by:
service in interface Serviceable
Overrides:
service in class AbstractAspect
Throws:
ServiceException
See Also:
Serviceable.service(org.apache.avalon.framework.service.ServiceManager)

configure

public void configure(Configuration config)
               throws ConfigurationException
Specified by:
configure in interface Configurable
Throws:
ConfigurationException
See Also:
Configurable.configure(org.apache.avalon.framework.configuration.Configuration)

toSAX

public void toSAX(RendererAspectContext context,
                  Layout layout,
                  PortalService service,
                  ContentHandler handler)
           throws SAXException
Description copied from interface: RendererAspect
Stream out raw layout

Specified by:
toSAX in interface RendererAspect
Overrides:
toSAX in class AbstractAspect
Throws:
SAXException
See Also:
RendererAspect.toSAX(org.apache.cocoon.portal.layout.renderer.aspect.RendererAspectContext, org.apache.cocoon.portal.layout.Layout, org.apache.cocoon.portal.PortalService, org.xml.sax.ContentHandler)

getStylesheetURI

protected String getStylesheetURI(XSLTAspect.PreparedConfiguration config,
                                  Layout layout)
                           throws SAXException
Throws:
SAXException

getParameterValue

protected String getParameterValue(Map.Entry entry)
                            throws SAXException
Throws:
SAXException

prepareConfiguration

public Object prepareConfiguration(Parameters configuration)
                            throws ParameterException
Description copied from interface: RendererAspect
Compile the configuration. A renderer aspect can "compile" the configuration in order to increase performance. If the renderer does not want to compile it should simply return the configuration. The "compiled" configuration is available during streaming via the context object. This method can also be used for validating the configuration.

Specified by:
prepareConfiguration in interface RendererAspect
Overrides:
prepareConfiguration in class AbstractAspect
Throws:
ParameterException
See Also:
RendererAspect.prepareConfiguration(org.apache.avalon.framework.parameters.Parameters)

dispose

public void dispose()
Specified by:
dispose in interface Disposable
See Also:
Disposable.dispose()


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.