Class XsltAggregationStrategy

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.AggregationStrategy, org.apache.camel.CamelContextAware, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

    public class XsltAggregationStrategy
    extends org.apache.camel.support.service.ServiceSupport
    implements org.apache.camel.AggregationStrategy, org.apache.camel.CamelContextAware
    The XSLT Aggregation Strategy enables you to use XSL stylesheets to aggregate messages.

    Since XSLT does not directly support providing multiple XML payloads as an input, this aggregator injects the new incoming XML document (newExchange) into the oldExchange as an exchange property of type Document. The old exchange therefore remains accessible as the root context. This exchange property can then be accessed from your XSLT by declaring an <xsl:param /> at the top of your stylesheet: The exchange property name defaults to new-exchange but can be changed through setPropertyName(String).

    Some code bits have been copied from the XsltEndpoint.

    • Constructor Detail

      • XsltAggregationStrategy

        public XsltAggregationStrategy​(String xslFileLocation)
        Constructor.
        Parameters:
        xslFileLocation - location of the XSL transformation
    • Method Detail

      • getCamelContext

        public org.apache.camel.CamelContext getCamelContext()
        Specified by:
        getCamelContext in interface org.apache.camel.CamelContextAware
      • setCamelContext

        public void setCamelContext​(org.apache.camel.CamelContext camelContext)
        Specified by:
        setCamelContext in interface org.apache.camel.CamelContextAware
      • aggregate

        public org.apache.camel.Exchange aggregate​(org.apache.camel.Exchange oldExchange,
                                                   org.apache.camel.Exchange newExchange)
        Specified by:
        aggregate in interface org.apache.camel.AggregationStrategy
      • setOutput

        public void setOutput​(XsltOutput output)
      • setUriResolver

        public void setUriResolver​(URIResolver uriResolver)
      • setTransformerFactoryClass

        public void setTransformerFactoryClass​(String transformerFactoryClass)
      • setTransformerFactory

        public void setTransformerFactory​(TransformerFactory transformerFactory)
      • getPropertyName

        public String getPropertyName()
      • setPropertyName

        public void setPropertyName​(String propertyName)
      • createXsltBuilder

        protected XsltBuilder createXsltBuilder()
      • doInit

        protected void doInit()
                       throws Exception
        Overrides:
        doInit in class org.apache.camel.support.service.BaseService
        Throws:
        Exception
      • doStart

        protected void doStart()
                        throws Exception
        Overrides:
        doStart in class org.apache.camel.support.service.BaseService
        Throws:
        Exception
      • doStop

        protected void doStop()
                       throws Exception
        Overrides:
        doStop in class org.apache.camel.support.service.BaseService
        Throws:
        Exception