RE: [xsl] Preserve HTML formatting when apply-templates in variabl

Subject: RE: [xsl] Preserve HTML formatting when apply-templates in variabl
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Mon, 9 Aug 2004 10:37:10 -0400
> From: Chris Loschen [mailto:closchen@xxxxxxxxxxxxxxxxxx]
>
>
> Here's the situation: I've got a very large input file which would
> overflow my
> memory if I ran the XSLT all at once. So instead I'm breaking up the
file
> into
> smaller pieces and running each one separately. More specifically, the
> file
> is set up like
>
> <!ELEMENT root (header, bill+, trailer)>
>
> and I need to process the header, each individual bill, and finally
the
> trailer
> in a series of XSLT transforms, usually more than a thousand all told.
> However, I do need to retain some of the data from the transforms as I
go
> because I need to include a grand total of the amount billed and the
total
> number of records in the trailer data.
>
> I'm using XSLT 1 and Xalan-J.
>
> What I've done is use xalan:write when I process the header like so:
>
> <xalan:write file="bills.xml">
> <xsl:text disable-output-escaping="true">&lt;root&gt;</xsl:text>
> </xalan:write>

I think I would either pass a parameter into each invocation of the
stylesheet.  Then I would use the global param to insert the running
total wherever I needed it, presumably at the end.  I might pass in
another parameter that indicates when we are at the last fragment, so
that the running total can be inserted.  You could output the running
total to a separate file (or maybe to an environmental variable,
depending on how you are orchestrating the process), which your driver
could read to pick up the current total.  No partial elements needed
this way.

Cheers,

Tom P

Current Thread