Re: [xsl] Appending output to multiple documents

[ Forwarded to xsl-editors from xsl-list post by
  "Rafael R. Sevilla" <sevillar@team.ph.inter.net> , 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@w3.org
(I've Cc'ed them).

  http://www.w3.org/TR/xslt11/#multiple-output
  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 http://www.w3.org/TR/xslt11 ) 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

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
veillard@redhat.com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

Received on Tuesday, 12 June 2001 04:38:12 UTC