Ellonnic2 wrote:
> Hello,
>
> I already have a XalanParsedSource and multiple XSLTInputSources. I want to
> transform my XalanParsedSource using each of the XSLTInputSources, while
> each time feeding the result of the transformation into the next
> transformation without touching the hard drive until the very end. Here is
> some pseudocode that should help to convey what I'm trying to accomplish:
>
> void ApplyXSLTCascade(
> XalanParsedSource originalXPS,
> XSLTInputSource styleSheetsArray[],
> char* fileName)
> {
> XalanParsedSource xps = originalXPS;
> for (each XSLTInputSource x in styleSheetsArray)
> {
> xps = transform(xps, x)
> }
>
> if (fileName)
> writeToFile(xps, fileName)
> else
> writeToConsole(xps)
> }
>
> As I mentioned, this unfortunately needs to be as-fast-as-possible and so
> the program cannot touch the disk until after the last transformation has
> been applied. Does anyone have any ideas on how to do this?
You can do this by transforming to another source tree, but you will
need to make sure your stylesheet produces a well-formed XML document.
It will also require a fair amount of memory, since you'll have multiple
trees in memory at the same time.
Is there any reason you just can't transform to a memory buffer? Take a
look at the StreamTransform sample for more information on how to do
that. This requires more parsing time, but doesn't place any limitations
on the result of the transformation, and doesn't require multiple trees
in memory at the same time.
Dave