[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: Producing multiple result files


Subject: Re: Producing multiple result files
From: Tyler Baker <tyler@xxxxxxxxxxx>
Date: Sat, 09 Jan 1999 03:18:06 -0500

James Tauber wrote:

> -----Original Message-----
> From: Tyler Baker <tyler@xxxxxxxxxxx>
>
> >The implementation a group of people I consult with currently use involves
> >caching the stylesheet in-memory and sometimes caching the source tree as
> >well.  Since the stylesheets are for the most part static, you simply run
> the
> >XSL Processor several different times using the same source tree, but using
> >different stylesheets (since the object representation of the stylesheet
> which
> >may be a DOM tree is stored in memory, you do not need to waste time
> reparsing
> >it).
>
> [...]
> >Is this what you are talking about or else am I confused with what you mean
> by
> >producing "multiple result files"?
>
> Yes, this is the idea, although I would like to be able to do it with a
> single stylesheet.
>
> Imagine you had an XML document
>
> <document>
>   <section name="sec1">
>     ...
>   </section>
>   <section name="sec2">
>     ...
>   </section>
>   <section name="sec3">
>     ...
>   </section>
> </document>
>
> I'd like to be able to produce 3 separate HTML files from this one document.
> Now it *is* possible to have three separate stylesheets to do this, but I'd
> prefer to have one.
>
> What I'd like is to be able to say something like
>
> <xsl:template match="section">
>   <xsl:result-file filename="{@name}.html">
>     <xsl:apply-templates/>
>   </xsl:result-file>
> </xsl:template>
>
> with each result-file in the result tree being serialisable to a different
> file given by its filename attribute.

OK I see what you are saying here.  Well one thing that you could do is have a
random-access stylesheet (like a DOM representation) and simply make the
necessary changes dynamically for each stylesheet.  You would still have three
separate stylesheets in a sense, but you would not have the overhead of totally
rebuilding the stylesheet tree if one trivial styling change needed to be made
for multiple stylesheets that does not involve messing around with the source
tree (like background color for example).  This would be the cleanest way of
doing things other than just having separate stylesheets altogether.

Tyler


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords
xml