You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Wilhelm Vortisch <wi...@isst.fhg.de> on 2001/02/06 17:37:26 UTC
Help needed: Xalan-J and Xalan-C produce different output!
Hi *,
I have wrote a little application (only read in a XML document via
Xerces, making a XSL Transformation and write the new document to stdout
...) in C++ and in Java.
In Java all works fine, but on C++ the output document is not the same
...
I have build my demo program up the examples and the description in the
Xalan documentation ...
Xalan-C shifts parameters and I do not know why ....
Here is a little example:
---------------- source document snipp ------------
<card id="main">
<p>
<fieldset class="vertical">
<fieldset class="horizontal">
---------------- end source document snipp ------------
after XSL transformation (Xalan-J):
---------------- result document 1 snipp ------------
<card id="main" newcontext="false" ordered="true">
<p align="left">
<fieldset class="vertical">
<fieldset class="horizontal">
---------------- end result document 1 snipp ------------
after XSL transformation (Xalan-C) - the error case:
---------------- result document 2 snipp ------------
<card>
<p>
<fieldset>
<fieldset>
---------------- end result document 2 snipp ------------
(Now the next <card> tag has the parameter id with the right value
"main"!!)
Why that??
Any tips/notes are welcome ....
CU
Wilhelm
P.S. Here is the code in my C++ program (edited for your eyes) ...
---------------- snipp --------------------------------------
// read the XML file with Xerces parser
XSLTInit theInit;
// Create the support objects that are necessary for running the
processor...
XercesDOMSupport theDOMSupport;
// DOMSupportDefault theDOMSupport;
XercesParserLiaison theParserLiaison( theDOMSupport );
XPathSupportDefault theXPathSupport( theDOMSupport );
XSLTProcessorEnvSupportDefault theXSLTProcessorEnvSupport;
XObjectFactoryDefault theXObjectFactory;
XPathFactoryDefault theXPathFactory;
// Create a processor...
XSLTEngineImpl theProcessor( theParserLiaison,
theXPathSupport,
theXSLTProcessorEnvSupport,
theDOMSupport,
theXObjectFactory,
theXPathFactory );
// Connect the processor to the support object...
theXSLTProcessorEnvSupport.setProcessor(&theProcessor);
XPathFactoryDefault theStylesheetXPathFactory;
// Create a stylesheet construction context, and a stylesheet
// execution context...
StylesheetConstructionContextDefault theConstructionContext(
theProcessor,
theXSLTProcessorEnvSupport,
theStylesheetXPathFactory );
StylesheetExecutionContextDefault theExecutionContext( theProcessor,
theXSLTProcessorEnvSupport,
theXPathSupport,
theXObjectFactory );
const XalanDOMString theXSLFileName( xsltSourcePath1
);
// Our input sources...
XalanDocument* theDoc = theParserLiaison.createDocument(
parser.getDocument() );
XSLTInputSource theInputSource(theDoc);
XSLTInputSource
theStylesheetSource(c_wstr(theXSLFileName));
// If you want to produce DOM output, create an empty XalanDocument
// to contain the transformation output.
XalanDocument* docOut = theParserLiaison.createDocument();
XSLTResultTarget theDOMResultTarget(docOut);
theProcessor.process( theInputSource,
theStylesheetSource,
theDOMResultTarget,
theConstructionContext,
theExecutionContext);
// After you perform the transformation, the XalanDocument contains
// the output.
// You can also convert the XalanDocument to a Xerces DOM_Document.
DOM_Document domOut = theParserLiaison.mapXercesDocument(docOut);
new DOMPrinter( domOut ); // print out a DOM Tree
---------------- snipp --------------------------------------
--
Fraunhofer ISST | Telefon : +49 (0) 30/2 43 06-4 22
Bereich ITM | Telefax : +49 (0) 30/2 43 06-1 99
Mollstr. 1 | E-Mail : Wilhelm.Vortisch@isst.fhg.de
D-10178 Berlin | Internet : http://www.isst.fhg.de