atom feed5 messages in net.sourceforge.lists.saxon-helpRE: [saxon] [XTDE1480] result-documen...
FromSent OnAttachments
Florent GeorgesMar 2, 2006 5:59 am 
Michael KayMar 2, 2006 6:15 am 
Florent GeorgesMar 2, 2006 6:47 am 
Florent GeorgesMar 2, 2006 7:07 am 
Michael KayMar 2, 2006 7:25 am 
Subject:RE: [saxon] [XTDE1480] result-document outside the final result tree: my fault or a lazy evaluation bug?
From:Michael Kay (
Date:Mar 2, 2006 6:15:05 am


<xsl:result-document href=".debug-out.xsl">

will certainly give you this error: you can't use xsl:result-document inside a function (because it would a side-effect of the function call. For debugging, use xsl:message instead.

I can't tell whether the error is legitimate for the first xsl:result-document because you haven't shown the context in which it appears. Try using -T: if the result-document instruction is evaluated when there's an open xsl:function or xsl:variable on the stack, then XTDE1480 is the correct result.

-----Original Message----- From: [] On Behalf Of Florent Georges Sent: 02 March 2006 13:58 To: Saxon Help SF list Subject: [saxon] [XTDE1480] result-document outside the final result tree: my fault or a lazy evaluation bug?


I just got the following error message (after stripped out the package names and a little reformating):

XTDE1480: Error in call to extension function {DocumentInfo transform(XPathContext,Templates,NodeInfo) throws XPathException}: Cannot switch to a final result destination while writing a temporary tree

I have the following instructions:

<xsl:variable name="script.compiled" select="thoth:compile-script($script)"/>

<xsl:result-document href="{$fo.uri}" method="xml"> <!-- Below is the number line of the reported error. --> <xsl:sequence select="saxon:transform($script.compiled, doc($image.uri))"/> </xsl:result-document>

<xsl:function name="thoth:compile-script"> <xsl:param name="script" as="xs:string"/> <xsl:variable name="uri" select="thoth:resolve-script($script)"/> <xsl:choose> <xsl:when test="$lang or $logo"> <xsl:variable name="doc"> <xsl:apply-templates select="doc($uri)" mode="modify.script"/> </xsl:variable> <!-- Just to debug. --> <xsl:result-document href=".debug-out.xsl"> <xsl:sequence select="$doc"/> </xsl:result-document> <xsl:sequence select="saxon:compile-stylesheet($doc)"/> </xsl:when> <xsl:otherwise> <xsl:sequence select="saxon:compile-stylesheet(doc($uri))"/> </xsl:otherwise> </xsl:choose> </xsl:function>

I suspect this to be related to a lazy evaluation bug. Does I provide more info here, or do I have to go directly to XSL List?

Thanks for your help.