You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by Zoltan Glozik <zo...@sse.ie> on 2001/11/09 12:23:26 UTC
Xerces-Xalan interoperability problem.
Hi,
I tried to execute an XSLT transformation on a DOM tree which was parsed by
Xerces and I got a -2 result code from XalanTransformer::transform. If I
don't parse the source file first, but rather provide the file name for
XSLTInputSource, everything works fine.
Here is the code that doesn't work:
-----------------------
DOMParser theParser;
theParser.setToCreateXMLDeclTypeNode(false);
theParser.parse("Data/trans_input1.xml");
const DOM_Document theDOM = theParser.getDocument();
XercesDOMSupport theDOMSupport;
XercesParserLiaison theParserLiaison(theDOMSupport);
XalanDocument* loXMLDocBridge =
theParserLiaison.createDocument(theDOM);
XSLTInputSource loXMLIn(loXMLDocBridge);
XSLTInputSource loInStyle("Data/trans_input1.xsl");
XSLTResultTarget loOut("Data/trans_output1.xml");
XalanTransformer loXalanTransformer;
int liResult = loXalanTransformer.transform(loXMLIn, loInStyle, loOut);
// liResult == -2 here.
-----------------------
And here is the code that works:
-----------------------
XSLTInputSource loXMLIn("Data/trans_input1.xml");
XSLTInputSource loInStyle("Data/trans_input1.xsl");
XSLTResultTarget loOut("Data/trans_output1.xml");
XalanTransformer loXalanTransformer;
int liResult = loXalanTransformer.transform(loXMLIn, loInStyle, loOut);
// liResult == 0 here.
-----------------------
What am I doing wrong? What are my options for using a Xerces DOM tree as an
input source for XSLT transformation?
I am using Xalan 1.2 on Win32 platform with Xerces 1.5.1 (I compiled both).
Thanks,
Zoltan