RE: [xsl] Reading and writing into the same file

Subject: RE: [xsl] Reading and writing into the same file
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 9 Mar 2010 16:36:03 -0000
> In XSLT 1.1 it was possible to read a file in to the XSLT 
> then rewrite to that same file using the xsl:document 
> function. In XSLT 2 the same is only possible if you use an 
> extension function such as saxon:discard-document together 
> with xsl:result-document. Is this correct and why has this happened?

XSLT 1.1 was only a working draft and never went through the kind of
thorough review needed to get a spec to Recommendation status. The
consequences of allowing the same document to be read and written in the
same transformation were therefore not discovered until later.
(Specifically, order of execution is not defined, so the stylesheet author
has no way of controlling whether the read happens before the write, or
after it.)

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 

Current Thread