[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: dvint@xxxxxxxxx
Date: Thu, 4 Apr 2013 14:03:33 -0700

It looks like this is more the issue:

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

Same situation applies, tha the result document should be closed, but it
is writing to the same file twice within the session. This happens in
single file mode in kernow as well as the directory mode.


> 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:
>
> <concept>
>    <h1 conref="file2.xml#sysoutput"></h1>
>    <h2 conref=file2.xml#inline"></h2>
> </concept>
>
>
> File2.xml structure:
>
> <concept>
>     <h1 id="sysoutput">
>        <p>This is the first set of content</p>
>     </h1>
>     <h2 id="inline">
>        <p>this is the second referenced content</p>
>     </h2>
> </concept>
>
> Need to change this to be:
>
>
> Topic file structure:
>
> <concept>
>    <h1 conref="file2-sysoutput.xml#sysoutput"></h1>
>    <h2 conref=file2-inline.xml#inline"></h2>
> </concept>
>
>
> File2-sysoutput.xml structure:
>
> <concept>
>     <h1 id="sysoutput">
>        <p>This is the first set of content</p>
>     </h1>
> </concept>
>
>
> File2-inline.xml structure:
>
> <concept>
>     <h2 id="inline">
>        <p>this is the second referenced content</p>
>     </h2>
> </concept>
>
>
> 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}">
>      <concept>
> 	<xsl:apply-templates
> select="doc($conref-sourcefile)//*[@id=$target-id]"/>
>      </concept>
>   </xsl:result-document>
>
> <!-- return the new conref statement to replace the one we found -->
>    <xsl:attribute name="conref" select="$newconref"/>
> </xsl:template>
>
> 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
> error.
>
> ..dan


Current Thread
Keywords