Bug #1872
closeddoc-available() fails with error on XML parse error
100%
Description
The XPath specification for doc-available mentions that an error can be raised only if the used URI is not valid according to the rules applied by the implementation of fn:doc. Otherwise, if unsuccessful, the function should return false.
http://www.w3.org/TR/xpath-functions/#func-doc-available
One of our Oxygen users reported that this is not the case of Saxon 9.5 and doc-available raises a SXXP0003 error.
We've tested with these files:
bad.xml
<bad>content & stuff</bad>
test.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="2.0">
<xsl:template name="start">
<xsl:if test="doc-available('bad.xml')">
<xsl:message>worked</xsl:message>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
When running Saxon 9.5.0.2 in the command line:
java -cp saxon9ee.jar net.sf.saxon.Transform -xsl:test.xsl -it:start
the transformation fails with an error:
Error on line 1 column 15 of bad.xml:
SXXP0003: Error reported by XML parser: The entity name must immediately follow the '&' in
the entity reference.
<?xml version="1.0" encoding="UTF-8"?>
I've also tested this with older versions of Oxygen/Saxon 9 and this seems to go back at least as far as Saxon 9.1.
Seems related to:
Related issues
Please register to edit this issue