RE: [xsl] Appending output to multiple documents

Subject: RE: [xsl] Appending output to multiple documents
From: "Rafael R. Sevilla" <sevillar@xxxxxxxxxxxxxxxxx>
Date: Tue, 12 Jun 2001 23:23:53 +0800 (PHT)
On Tue, 12 Jun 2001, Michael Kay wrote:

> > Been playing a bit with Saxon and its partial implementation
> > of the XSLT
> > 1.1 draft.  here. I've been wondering if there is a way for multiple
> > <xsl:document/> constructions that reference the same file to *append*
> > their outputs to the file instead of truncating the original file and
> > replacing its contents.
> No, that's not part of the W3C specification, and it's not part of the Saxon
> implementation. I think the xalan:redirect extension offers this capability,
> though.

I found that out the hard way. :)

> It's difficult to specify because it's intrinsically undefined what order
> things happen in: XSLT is not a sequential language.

Well, what if I used <xsl:for-each/>?  If I did something like:

<xsl:for-each select="some-xpath-expr-that-specifies-the-nodes-i-want">
  <xsl:document href="....">
  </xsl:document href>

I would imagine that <xsl:for-each/> would give me each node the xpath
expression would find, in the order they appeared in the document.

> I would suggest writing the output files to separate entities, and then
> bringing them together using entity references; or just rearrange the
> stylesheet logic so each output file is written by one template - that's how
> you have to organise things to produce any other chunk of output, after all.

Well, I've been busting my brain to figure out how this is done.  Maybe
I'm just too biased from my many years of exposure to almost nothing but
imperative programming languages! :)  Anyhow, my actual application for
this was to create an XSL stylesheet that duplicated the effects of
XML-Tangle by Jonathan Bartlett
(http://members/  Here, we have a DocBook XML
document with <programlisting/> sections marked with role attributes that
give the file name for the source file for output.  <programlisting/>
elements that have the same source file output are definitely possible,
and their contents should be appended to that file.  Now, if I wanted to
produce a single <xsl:document/> for every file only once, I would then
need to find all the <programlisting/> elements in the document which
produced output to the same file...  I'm not sure how this can be done.

Rafael R. Sevilla <sevillar@xxxxxxxxxxxxxxxxx>   +63(2)   8177746 ext. 8311
Programmer, InterdotNet Philippines              +63(917) 4458925

Version: 3.12
GAT d- s:- a- C++++ UL+++ P+++ L+++ E++ W++ N+ o K- w---
O- M-- V- PS+ PE Y+ PGP++ t+ 5 X+ R tv+ b+++ DI++ D+
G e++ h! r++ y+

 XSL-List info and archive:

Current Thread