The only alternative seems to be to pass the filename in the header
and then use the document function to get the xml fragment:
in Java:
.setHeader("agents.xml",
constant(getCacheLocation() + "/agents.xml"))
in the xsl:
<xsl:value-of select="document($agents.xml)/
agents/agent" />
On 5 mei 2009, at 12:19, Gert-Jan van de Streek wrote:
Whatever I convert it to, it makes no difference. If I create an
explicit NodeSet and set it, I get
Invalid conversion from NodeSet to node-set
I use Camel 1.6.0
It makes no difference running Java 1.5 or 1.6.
On 4 mei 2009, at 22:47, Gert-Jan van de Streek wrote:
I want to pass an xml fragment to an xslt. I have the following
code where the queue holds xml messages
from("activemq:example.A")
.setHeader("agent.id", new XPathExpression("/"))
.process(new ReadLocalFile())
.to("xslt:transform.xsl")
The xslt looks like:
...
<xsl:param name="agent.xml"/>
<xsl:template match="/">
<xsl:value-of select="$agent.xml/agent/id" />
I would expect the xml fragment to be available as a nodeset in the
xsl, but I get the following exception:
javax.xml.transform.TransformerException:
java.lang.RuntimeException: Invalid conversion from
'com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList' to 'node-set'.
at
com
.sun
.org
.apache
.xalan
.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:
670)
at
com
.sun
.org
.apache
.xalan
.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:
300)
at
org.apache.camel.builder.xml.XsltBuilder.process(XsltBuilder.java:83)
...
Any ideas on how to solve this?