Re: [xsl] Stylesheet in a Xerces DOM tree?

Subject: Re: [xsl] Stylesheet in a Xerces DOM tree?
From: david_n_bertoni@xxxxxxxxxx
Date: Wed, 26 May 2004 18:28:40 -0700
> I've got a XSL stylesheet which was preparsed by Xerces as part of the
> initialization of my application. I need to be able to pass that DOM
> tree to the transformer to run the transformation.
>
> So far I've been unable to figure out how to get it to work.  What I
> want is something like this:
>
>     Xercesc_2_5::DOMElement *stylesheet;  // This was parsed earlier by
> Xerces duing my program initialization
>     Xercesc_2_5::DOMDocument *sourceDoc;  // The DOM document I want to
> transform
>     Xercesc_2_5::DOMDocument *outputDoc;  // The DOM document I want the
> results placed in.
>
>     XalanTransformer transformer;
>
>     // transform the sourceDoc. In reality if I can only get a string
> back as the output of the transform,
>     // I'm not as concerned but I really need to pass the DOMDocument
> (or element) as the stylesheet.
>     Transformer.transform (sourceDoc, stylesheet, outputDoc);
>
> Is anything like this possible? Or do I have to convert my xerces-parsed
> DOM tree back to a string and let Xalan re-parse it?
>
> Any pointers would be appreciated.

It's possible, although not terribly pretty or efficient.  However, this
really isn't the appropriate forum for processor-specific questions.  You
can always subscribe and post to the Xalan-C Users list:

   http://xml.apache.org/mail.html#xalan-c-users

Note you can also get the output as an instance of the Xerces-C DOM, if the
transformation produces a well-formed XML document.  See the samples for
more information.

Dave

Current Thread