Re: [xsl] Appending output to multiple documents

Subject: Re: [xsl] Appending output to multiple documents
From: Daniel Veillard <Daniel.Veillard@xxxxxxx>
Date: Tue, 12 Jun 2001 10:38:03 +0200
[ Forwarded to xsl-editors from xsl-list post by
  "Rafael R. Sevilla" <sevillar@xxxxxxxxxxxxxxxxx> , Daniel ]

On Tue, Jun 12, 2001 at 03:53:48PM +0800, Rafael R. Sevilla 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.  Useful for the case where I had two different
> templates that had to spew their output to the same file, in the order
> they were matched.  Is there something in the standard I missed, or is
> this currently impossible and I would need to hack my XSLT processor and
> then propose to the W3C a mode attribute to <xsl:document/> that would
> control whether output to files that already exist should be appended or
> overwritten?

  Hum, that's an interesting point.
  The proper way to give feedback to the XSL WG is to send the message
to the feedback list associated to this specification xsl-editors@xxxxxx
(I've Cc'ed them).
  last paragraph says:

It is an error if the set of documents to be output as the result of a
single XSLT transformation (that is, the main result document and its
subsidiary documents recursively) contain two documents with the same
output URI.

  So the current draft actaully forbids what you are suggesting.

  Note however that the resource being written to is referenced by an
URI-Reference, and hence can point to any kind of Web resource, and
it is sometimes very difficult (impossible) to know if 2 URI-References 
point to the same resource and how opening them twice for writing would
work in practice (I assume file:// would overwrite the content in most
cases but irc:// would just generate the content twice).

  Though the XSLT-1.1 draft is no longer maintained (this is public
knowledge but not stated at ) it would
be useful that the next XSLT revision (if it include xsl:document)
add something about the impossibility to guess if 2 different output URI
are actually the same resource (and the hazard which can results when
this happens). 


Daniel Veillard      | Red Hat Network
veillard@xxxxxxxxxx  | libxml Gnome XML XSLT toolkit | Rpmfind RPM search engine

 XSL-List info and archive:

Current Thread