[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Cannot write more than one result document to the same

Subject: Cannot write more than one result document to the same URI
From: dvint@xxxxxxxxx
Date: Thu, 4 Apr 2013 13:42:25 -0700
 Cannot write more than one result document to the same
I understand why this might be an issue to have two different streams
writing to the same file, but should this always fail just because the
file is opened twice for write in one stylesheet?

I'm trying to process some DITA content that is using conrefs (think
xinclude statements). So I have one file that makes 2 references to
another file to include content from that second file.

We want to change this arrangement such that there is only one includable
section in a given file. So I'm splitting the second file into 2 new files
and modifying the references accordingly in the first.

Here is s simplified view of what is going on (for those that know DITA
please excuse the pseudo code):

Topic file structure:

   <h1 conref="file2.xml#sysoutput"></h1>
   <h2 conref=file2.xml#inline"></h2>

File2.xml structure:

    <h1 id="sysoutput">
       <p>This is the first set of content</p>
    <h2 id="inline">
       <p>this is the second referenced content</p>

Need to change this to be:

Topic file structure:

   <h1 conref="file2-sysoutput.xml#sysoutput"></h1>
   <h2 conref=file2-inline.xml#inline"></h2>

File2-sysoutput.xml structure:

    <h1 id="sysoutput">
       <p>This is the first set of content</p>

File2-inline.xml structure:

    <h2 id="inline">
       <p>this is the second referenced content</p>

So my stylesheet is processing the topic file. I have a template that is
triggered when an @conref attribute is found and it creates the new
attribute value as well as making the new file.

<xsl:template name="make-conref">
<xsl:param name="file" as="xs:string"/>
<xsl:param name="conref-sourcefile" as="xs:string"/>
  <xsl:result-document method="xml"  encoding="UTF-8" href="{$file}">
	<xsl:apply-templates select="doc($conref-sourcefile)//*[@id=$target-id]"/>

<!-- return the new conref statement to replace the one we found -->
   <xsl:attribute name="conref" select="$newconref"/>

So this template gets the modified filename that uses the id value to make
it unique, processes the included section and closes the result document
before continuing to the next content.

I could see this error being raised if one of the conref'd sections
actually made a circular reference to itself, but I have not been able to
find this situation.

One other detail is I'm using Kernow to process a directory with the same
stylesheet. So maybe there is something with the caching going on? I've
set the multi-threading to use a single thread so there should be no
collisions there.

Kernow reports that it is net.sf.saxon.trans.XPathException throwing the


Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.