Colin/David,
Quick patch to provide an overload for XalanTransformer::transform with parsed XML containing stylesheet in PI node.
(Diff is against CVS at time of sending.)
Cheers, Berin
David N Bertoni/Cambridge/IBM wrote:
Hi Berin,
At one point, I think I took a step back and tried to keep the transform() overloads from exploding into every possible combination. We could add another one for this case, but the one you mention ought to handle work.
So, Colin, have you tried it, and does it work? If so, we could just document that this is the way to do it if you want to use a stylesheet PI. If it doesn't work, we can either fix it, or add the overload.
Berin, do you want to do a patch for the overload? I think it's fine to add a few targetted ones, but we should do them sparingly.
Dave
|---------+---------------------------> | | Berin Lautenbach| | | <[EMAIL PROTECTED]| | | om.au> | | | | | | 02/01/2003 01:09| | | PM | |---------+---------------------------> >--------------------------------------------------------------------------------------------------------------------------------| | | | To: xalan-c-users@xml.apache.org | | cc: (bcc: David N Bertoni/Cambridge/IBM) | | Subject: Re: XalanParsedSource and xml-stylesheet processing instruction | >--------------------------------------------------------------------------------------------------------------------------------|
Colin,
[As an aside - meant to say last night - just put the bugzilla report in as against the latest version and mark in the text that it actually applies to CVS.]
Had a look - probably should be added to the API (David?) but in the interim, you _should_ be able to do this using an empty XSLTInputSource - ie.
transform(theParsedSource, XSLTInputSource(), theResultTarget);
Cheers, Berin
Colin Paul Adams wrote:
Looking through the documentation , and the header file, I cannot see a version of XalanTransformer::transform that takes a XalanParsedSource as input, and allows you to miss out the stylesheet. Does this mean that a XalanParsedSource does not store any xml-stylesheet instruction?
Index: src/XalanTransformer/XalanTransformer.cpp =================================================================== RCS file: /home/cvspublic/xml-xalan/c/src/XalanTransformer/XalanTransformer.cpp,v retrieving revision 1.65 diff -C5 -p -r1.65 XalanTransformer.cpp *** src/XalanTransformer/XalanTransformer.cpp 10 Jan 2003 05:01:30 -0000 1.65 --- src/XalanTransformer/XalanTransformer.cpp 2 Feb 2003 07:04:45 -0000 *************** XalanTransformer::transform( *** 357,366 **** --- 357,378 ---- theInputSource, XSLTInputSource(), theResultTarget); } + int + XalanTransformer::transform( + const XalanParsedSource& theParsedXML, + const XSLTResultTarget& theResultTarget) + { + + // Do the transformation + return transform( + theParsedXML, + XSLTInputSource(), + theResultTarget); + } int XalanTransformer::transform( const XSLTInputSource& theInputSource, Index: src/XalanTransformer/XalanTransformer.hpp =================================================================== RCS file: /home/cvspublic/xml-xalan/c/src/XalanTransformer/XalanTransformer.hpp,v retrieving revision 1.46 diff -C5 -p -r1.46 XalanTransformer.hpp *** src/XalanTransformer/XalanTransformer.hpp 10 Jan 2003 05:01:30 -0000 1.46 --- src/XalanTransformer/XalanTransformer.hpp 2 Feb 2003 07:04:45 -0000 *************** public: *** 207,216 **** --- 207,231 ---- return doTransform(theParsedXML, theCompiledStylesheet, 0, theResultTarget); } /** + * Transform will apply the stylesheet provided as a PI in the + * XML of the parsed xml source and write the transformation output to + * the target. + * + * @param theParsedXML the parsed input source + * @param theResultTarget output source tree + * @return 0 for success + */ + int + transform( + const XalanParsedSource& theParsedXML, + const XSLTResultTarget& theResultTarget); + + + /** * Transform will apply the stylesheet source to the input source * and write the transformation output to the target. The input * source and result target can be a file name, a stream or a root * node. *