Hi:

Recently I am using camel xslt to do xml transform;

If the xslt processor's input is a xml string, the  transform result is
correct;

But if the xslt processor's input is a org.w3c.xml.Node which is build from
the exactly same xml string; then thing's will be very strange:

If I using the latest sun's JAXP implementation , a exception (Namespace for
prefix  has not been declared) always occurs; and if I switch to apache
xalan 2.7.1,the transform result is just a empty document;

Actually, I think this problem is the XSLT engine's reason; 
But after I explorer the source code of xalan, I find it seems xalan always
ask for the input DOM Node should be a document container. I am not sure if
this limit is a bug or a correct thing; 
Do anyone know it?

If the limit is correctly, Maybe the camel XSLT processor should wrapper a
DOM with a DocumentFragment, then build a DOMSource of DocumentFragment as
XSLT's input;
But if the limit is xslt engine bug, maybe we should waiting from xalan or
sun to correct this;


Ps: route & xml & xslt;
Route:( same route from DOM input & xml string input)
<from uri="direct:from"/>
<to uri="xslt:test/test.xsl?output=DOM"/>
<to uri="mock:result/>


Xml:
Input:
<?xml version="1.0" encoding="UTF-8"?>
<Record xmlns="http://test/record1";>
<content1>a</content1>
<content2>b</content2>
<content3>c</content3>
</Record>

Successful result:
<?xml version="1.0" encoding="UTF-8"?>
<tag0:Record xmlns:tag0="http://www.tongtech.com/tiwen/record1";>
<tag0:content1>a</tag0:content1>
<tag0:content2>c</tag0:content2>
<tag0:content3>b</tag0:content3>
</tag0:Record>

Xslt:
.....it's too long, and I am sure it's correct....; 


Reply via email to