Re: [xsl] RE:read-write same url in xslt 2 [was appendig to multiple output files]

Subject: Re: [xsl] RE:read-write same url in xslt 2 [was appendig to multiple output files]
From: Trevor Nash <tcn@xxxxxxxxxxxxx>
Date: Mon, 28 Jan 2002 10:23:47 +0000
>>This reminds me that we haven't said anything in XSLT 2.0 about what
>>if you try to read and write the same URL within a single transformation.
>>will have to say it's an error, but whether we say the processor has to
>>detect it and report it is another question.
>why does it have to be an error? it works with Saxon if you're using
How do you mean 'works' ?
If you have document('x') in your stylesheet this will see 'x' as it
exists *before* the transformation.  If you also have xsl:document
href="x" then this new 'x' doesn't get written until the result tree
is serialised.  I do not think that is what you are expecting?
Thats how Saxon works, because it puts the output in a temporary tree
which does not get serialized until it is complete: it would be wrong
for the specification to *require* that the creation of the new 'x'
should be delayed in this way - it is possible and maybe useful to
write a processor which writes the output to file as soon as it can,
in which case document('x') could see a half-written file.

The difficulty about making this a 'required error' is that the XSLT
processor does not understand all possible URI schemes: so it cannot
be made responsible for detecting that two apparently different
relative URIs actually refer to the same resource.  Then add URI
resolvers into the equation...

Summary- its a mistake to do this, even if it appears to work for a
particular processor.

Trevor Nash
Traditional training & distance learning,
Consultancy by email

Melvaig Software Engineering Limited
voice:     +44 (0) 1445 771 271 
email:     tcn@xxxxxxxxxxxxx

 XSL-List info and archive:

Current Thread