logo       

Re: Cannot write more than one result document to the same URI: null: msg#00128

Subject: Re: Cannot write more than one result document to the same URI: null
In this case <xsl:if test="not(@filename)"> means that nothing happens at all.

But to put that concern aside, the fragement below still fails, writing content1.xml correctly; and writes content2.xml with no content and what appears to be a hung file handle.:

<xsl:variable name="src">
    <doc>
        <content filename="content1">
            Content of element one
        </content>
        <content filename="content2">
            Content of element two
        </content>
    </doc>
</xsl:variable>

 <xsl:template match="/">
     <xsl:for-each select="$src/doc/content">
          <xsl:result-document href="" class="moz-txt-link-rfc2396E" href="mailto:../../{@filename}.xml">"../../{@filename}.xml">
             <xsl:copy-of select="."/>
         </xsl:result-document>
     </xsl:for-each>
 </xsl:template>

Roger Kovack


Michael Kay wrote:
Try
 
test="not(@filename)"
 
or
 
test="not(@filename = '')"
 
instead of
 
test="@filename != ''"
 
If there is no @filename attribute, then there is no @filename attribute whose value is not equal to "", so this test returns false. So if you have two elements with no @filename attribute, you will get two files called ".xml".
 
Michael Kay


From: saxon-help-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx [mailto:saxon-help-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx] On Behalf Of Roger Kovack
Sent: 28 May 2005 15:55
To: saxon-help-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx
Subject: Re: [saxon] Cannot write more than one result document to the same URI: null

You are right about the error being dynamic. I do get 2 reports from <xsl:message> and 2 file outputs before the fatal error. However, I am not writing to the same URI in this case. I'm using an AVT in the xsl:result-document/@href attribute and every output URI is unique. It feels like the AVT isn't being evaluated to determine the error condition but is being evalutated to determine the filename.

This fragment actually does write the file ../../content1.xml correctly and also *creates* a file named ../../content2.xml but it has no content and also seems to have lost a reference in Java because content2.xml cannot be deleted. That may be my fault, though.
Read further down for the var $src.

     <xsl:for-each select="$src/doc/content">
        <xsl:message>starting output <xsl:value-of select="@filename"/> </xsl:message>
         <xsl:if test="@filename != '' ">
             <xsl:result-document href="" class="moz-txt-link-rfc2396E" href="mailto:../../%7B@filename%7D.xml">"../../{@filename}.xml">
                 <xsl:copy-of select="."/>
             </xsl:result-document>
         </xsl:if>
     </xsl:for-each>

Roger Kovack

Michael Kay wrote:
This is a rule that has been in the spec for some time, but which wasn't enforced in Saxon until 8.4. In previous releases if you wrote two result documents to the same URI, the second overwrote the first (and in theory it's unpredictable which one that will be).
 
The reason for the rule in the spec is that it's not possible to define what the effect should be, therefore it either has to be implementation-dependent or an error, and the WG decided the latter. (Don't blame me, guv!)
 
I'm puzzled that you seem to be implying this error is reported before the transformation even starts. This is definitely a dynamic rather than a static error.
 
Michael Kay


From: saxon-help-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx [mailto:saxon-help-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx] On Behalf Of Roger Kovack
Sent: 27 May 2005 22:05
To: saxon-help-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx
Subject: [saxon] Cannot write more than one result document to the same URI: null

Is this a no-side effects concern? It seems to work in Saxon8.2 but not in Saxon8.4.

I'm trying to put indirection on <xsl:result-document> as follows:

<xsl:stylesheet
    version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
<xsl:variable name="src">
    <doc>
        <content filename="content1">
            Content of element one
        </content>
        <content filename="content2">
            Content of element two
        </content>
        <content>  <!-- @filename omitted -->
            Content of element with missing filename
        </content>
    </doc>
</xsl:variable>

 <xsl:template match="/">
     <xsl:for-each select="$src/doc/content">
          <!-- dont try this without a filename attribute -->
          <xsl:if test="@filename != '' ">
             <xsl:result-document href="" class="moz-txt-link-rfc2396E" href="mailto:../../%7B@filename%7D.xml">"../../{@filename}.xml">
                 <xsl:copy-of select="."/>
             </xsl:result-document>
         </xsl:if>
     </xsl:for-each>
 </xsl:template>

</xsl:stylesheet>

It feels like Saxon8.4 is suspicious of my attempt to write to the same result file more than once, but it hasn't even given me the chance to prove my innocence of that sin by throwing a configuration error before the transform even starts. I really do mean to obey the no side effects law although I admit I really don't think writing to the same output file is a side effect in the transform but rather a side effect in the external system. If the external system does not have side effects then all hope for transactional processing seems lost.

Thanks again for Saxon!!
Roger Kovack
------------------------------------------------------- This SF.Net email is sponsored by Yahoo. Introducing Yahoo! Search Developer Network - Create apps using Yahoo! Search APIs Find out how you can build Yahoo! directly into your own Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005 _______________________________________________ saxon-help mailing list saxon-help-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/saxon-help
------------------------------------------------------- This SF.Net email is sponsored by Yahoo. Introducing Yahoo! Search Developer Network - Create apps using Yahoo! Search APIs Find out how you can build Yahoo! directly into your own Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005 _______________________________________________ saxon-help mailing list saxon-help-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/saxon-help
------------------------------------------------------- This SF.Net email is sponsored by Yahoo. Introducing Yahoo! Search Developer Network - Create apps using Yahoo! Search APIs Find out how you can build Yahoo! directly into your own Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe