[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Appending output to multiple documents

Subject: RE: Appending output to multiple documents
From: "Rafael R. Sevilla" <sevillar@xxxxxxxxxxxxxxxxx>
Date: Tue, 12 Jun 2001 23:23:53 +0800 (PHT)
xslt output multiple document
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>
</xsl:for-each>

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/wri.com/johnnyb/xmltangle/).  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
http://dido.engr.internet.org.ph/

-----BEGIN GEEK CODE BLOCK-----
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+
------END GEEK CODE BLOCK------


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.