Forums » Help »
BUG? fn:doc-available
Added by Anonymous over 16 years ago
Legacy ID: #4916048
Legacy Poster: Harald Schmitt (hschmitt)
when you query sucessfully fn:doc-available($docURI) for a document it is added to
the net.sf.saxon.Controller.addUnavailableOutputDestination($docURI). A subsequent call
to <xsl:result-document href="{$docURI}"> will always
fial, even if the document has not been read. For example this stylesheet will alway
generate a dynamic error: <?xml version="1.0"
encoding="UTF-8"?> <xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema" >
<xsl:template match="/"> <xsl:variable
name="tmpURI" as="xs:anyURI"
select="resolve-uri('test.xml')"/> <xsl:choose>
<xsl:when test="doc-available($tmpURI)">
<xsl:result-document href="{$tmpURI}">
<whatever/> </xsl:result-document> </xsl:when>
<xsl:otherwise> <xsl:message
terminate="yes">doc should be
available></xsl:message> </xsl:otherwise>
</xsl:choose> </xsl:template>
</xsl:stylesheet>
Legacy ID: #4916174
Legacy Poster: Michael Kay (mhkay)
I believe this is a correct interpretation of the spec. Returning true from
doc-available() provides a guarantee that a subsequent call on document() will succeed,
and this guarantee cannot be honoured if a call on xsl:result-document is allowed to
write to the same URI. Michael Kay http://www.saxonica.com/
Please register to reply