public class XsltAggregationStrategy extends Object implements AggregationStrategy
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 and Description |
---|
XsltAggregationStrategy(String xslFileLocation)
Constructor.
|
public XsltAggregationStrategy(String xslFileLocation)
xslFileLocation
- location of the XSL transformationpublic Exchange aggregate(Exchange oldExchange, Exchange newExchange)
AggregationStrategy
aggregate
in interface AggregationStrategy
oldExchange
- the oldest exchange (is null on first aggregation as we only have the new exchange)newExchange
- the newest exchange (can be null if there was no data possible to acquire)public void setOutput(XsltOutput output)
public void setXslt(XsltBuilder xslt)
public void setUriResolver(URIResolver uriResolver)
public void setTransformerFactoryClass(String transformerFactoryClass)
public String getPropertyName()
public void setPropertyName(String propertyName)
protected void initialize(CamelContext context) throws Exception
Exception
protected void configureOutput(XsltBuilder xslt, String output) throws Exception
Exception
protected void loadResource(String resourceUri) throws TransformerException, IOException
resourceUri
- the resource to loadTransformerException
- is thrown if error loading resourceIOException
- is thrown if error loading resourcepublic static XsltAggregationStrategy create(String xslFile)
public XsltAggregationStrategy withPropertyName(String propertyName)
public XsltAggregationStrategy withOutput(XsltOutput output)
public XsltAggregationStrategy withUriResolver(URIResolver resolver)
public XsltAggregationStrategy withTransformerFactoryClass(String clazz)
public XsltAggregationStrategy withSaxon()
Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.