You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by richardgroote <ri...@gmail.com> on 2015/01/08 11:13:10 UTC

XSLT Component empty elements

Hello,

We are upgrading from Apache Camel version 2.12.2 to 2.14.0 but have some
problems with XSLT component.

The input for the XSLT component is xml with no namespaces in it (see
below). 
The result after the transformation does not contain any elements because
tests on the elements do not succeed. 

With the below test XSLT if tried to determine if the namespace is a problem
but both test elements are not within the response when using version 2.14.0

If changed the stylesheet to copy everything than i get a NPE in
org.apache.xml.serializer.ToXMLStream.addAttribute(ToXMLStream.java:451)

I've tried a couple of things but could not get it working.
(allowStAX, true or false does not matter)
(transformer is in both situation the same xalan transformer of JBoss)


Kind Regards,

Richard

Environment:
- MAC
- JBoss EAP 6.3.0
- Java 7







	<camel:route>
	        <camel:from uri="direct:SelectUsersFromDatasource"/>
	        
	       <camel:to uri="sql:select * from CMFUSER"/>
	       <camel:marshal>
  		  <camel:xstream/>
	      </camel:marshal>

	       <camel:to uri="file:///data/tmp?fileName=beforeXSLT.txt"/>
	        <camel:to
uri="xslt:file:///tmp/transform_resultset_to_event_response.xslt" />
		<camel:to uri="file:///data/tmp?fileName=afterXSLT.txt"/>
    	</camel:route>




<?xml version="1.0" encoding="UTF-8"?>
<list>
    <org.springframework.util.LinkedCaseInsensitiveMap
serialization="custom">
        <unserializable-parents/>
        <map>
            <default>
                <loadFactor>0.75</loadFactor>
                <threshold>24</threshold>
            </default>
            <int>32</int>
            <int>24</int>
            <string>ID</string>
            <long>1</long>
            <string>ORGANISATIONID</string>


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
	xmlns:know="http://someuri" 
	xmlns:cas="http://someuri2">
	
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

	<xsl:template match="/">
		<cas:eventResponse>			
			<xsl:if test="/list">
			  <xsl:element name="test1"></xsl:element>
			</xsl:if>
			<xsl:if test="/*[local-name()='list']">
			  <xsl:element name="test2"></xsl:element>
			</xsl:if>
			<test3></test3>
		</cas:eventResponse>
	</xsl:template>


</xsl:stylesheet>


<xsl:template match="node()|@*">
		<xsl:copy>
			<xsl:copy-of select="@*"/>
			<xsl:apply-templates select="node()"/>
		</xsl:copy>
	</xsl:template>




--
View this message in context: http://camel.465427.n5.nabble.com/XSLT-Component-empty-elements-tp5761456.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: XSLT Component empty elements

Posted by richardgroote <ri...@gmail.com>.
Hello,

When altering the camel route and adding convertBody to java.io.InputStream
just before the xslt solves this problem.
Also adding the streamcache option solves this problem.

I' am still curious why the caching or converting is necessary.

Kind regards,

Richard



--
View this message in context: http://camel.465427.n5.nabble.com/XSLT-Component-empty-elements-tp5761456p5761468.html
Sent from the Camel - Users mailing list archive at Nabble.com.