RE: [xsl] appending output to file using saxon

Subject: RE: [xsl] appending output to file using saxon
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Tue, 30 Apr 2002 09:07:04 +0100
> I want to cut a document into many smaller file fragments
> using XSL.  For this
> I use Saxon and <saxon:output>....  I
> actually want to keep
> this file open and append content to it.
>

The facility for multiple output files isn't designed to do this. There's a
good reason why: it would make the output dependent on the sequential order
of execution of instructions in the stylesheet.

It's probably best to think of multiple output files as if you were creating
a single "composite" result tree and then chopping off the branches.
Typically you want to create something like


root
  a
    b
      c
      c
    b
      c
      c
  a
    b
      c
    b

and then split the tree at the <b> nodes so the result is something like

principal-output.xml:

<doc>
 <a>
  <b href="out1.xml"/>
  <b href="out2.xml"/>
 </a>
 <a>
  <b href="out3.xml"/>
  <b href="out4.xml"/>
 </a>
</doc>

out1.xml:

  <b><c/><c/></b>

etc.

The structure of your stylesheet is then governed by the structure of the
"composite" result tree that you want to create. The nodes have to be
written to this composite result tree sequentially, just as if it were being
serialized to a single output file.

As always, if you explain in detail what you want the output to look like,
I'm sure someone can come up with a declarative way of creating it.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx


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


Current Thread