Hi Zoltan,

What you're doing isn't supported in Xalan 1.2.  If you want to get the
latest code from CVS, there is a new class that will wrap the Xerces DOM
instance.  Here's a code snippet:

 const char* const theURI = "Data/trans_input1.xml";

 DOMParser  theParser;
 theParser.setToCreateXMLDeclTypeNode(false);
 theParser.parse(theURI);
 const DOM_Document theDOM = theParser.getDocument();

 XercesDOMSupport theDOMSupport;
 XercesParserLiaison theParserLiaison(theDOMSupport);
 theDOMSupport.setParserLiaison(&theParserLiaison);

 // This is the new class...
 const XercesDOMWrapperParsedSource      loXMLDocWrapper(theDOM,
theParserLiaison, theDOMSupport, XalanDOMString(theURI));

 const XSLTInputSource loInStyle("Data/trans_input1.xsl");
 const XSLTResultTarget loOut("Data/trans_output1.xml");

 XalanTransformer loXalanTransformer;
 const int liResult = loXalanTransformer.transform(loXMLDocWrapper,
loInStyle, loOut);

If you have any problems, you should post a message to the list -- this
class is new and hasn't been extensively tested yet.

Dave



                                                                                
               
                    "Zoltan                                                     
               
                    Glozik"              To:     <[email protected]> 
               
                    <zoltan.glozi        cc:     (bcc: David N 
Bertoni/CAM/Lotus)              
                    [EMAIL PROTECTED]>            Subject:     Xerces-Xalan 
interoperability problem.   
                                                                                
               
                    11/09/2001                                                  
               
                    06:23 AM                                                    
               
                                                                                
               
                                                                                
               



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






Reply via email to