[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Cannot write more than one result document to the same URI


Subject: Re: [xsl] Cannot write more than one result document to the same URI
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 04 Apr 2013 21:52:01 -0400

At 2013-04-04 16:46 -0700, Dan Vint wrote:
I guess what I'm expecting is that the result document is closed once the </xslt:result-document> end tag is found.

Yes, it is.


Instead XSLT seems to keep this memory around that it is there.

No, not in memory.


I'm happy with just over writing the last file created as it is all the same content each time.

Fine ... if you can make the assumption that the same conref attribute will create the same output, then I have a suggestion for you.


Yeah maybe inefficient, but I expected it to work. Out of 3000 files I have to process with lots of need for this file splitting I found 2 that complain about writing to the same result document.

But that complaint isn't superfluous, it is explicit in the specification:


  http://www.w3.org/TR/2007/REC-xslt20-20070123/#element-result-document
  [ERR XTDE1490] It is a non-recoverable dynamic error for
  a transformation to generate two or more final result
  trees with the same URI.

With the first posting I wasn't sure where in the processing this was occurring, then I found the files that actually were trying to create the file twice. I still don't understand why this is a problem when the output file should be closed by the time the next write sequence is started.

It isn't a problem with the implementation, it is a formal aspect of the specification as cited above.


Could you simply check back to make sure you haven't already created the file?

   <xsl:if test="not(preceding::*[@conref=current()/@conref])">
     <xsl:result-document href=.......

So, for every unique conref attribute you'll get only a single invocation of <xsl:result-document>.

I hope this helps.

. . . . . . . . . Ken

--
Contact us for world-wide XML consulting and instructor-led training |
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm |
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/s/ |
G. Ken Holman                   mailto:gkholman@xxxxxxxxxxxxxxxxxxxx |
Google+ profile: https://plus.google.com/116832879756988317389/about |
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal |


Current Thread
Keywords