XSL try/catch does not prevent runtime error in Oxygen
Posted: Fri Dec 22, 2017 1:09 pm
Hi all,
i have a very simple XSLT transformation data.xsl. Inside, a boolean attribute is calculated as a comparison of a given value timestamp against current-dateTime. So timestamp has to be of type xs:dateTime. Transformation will fail with a runtime error if the input document is not validatend against a corresponding XSD Schema.
Next, i wrote an xsl stylesheet which calls fn:transform to invoke the transformation in data.xsl like this:
Applying this on a input-document which ist not validated against any schema (disable schema validation) gives me the message Runtime Error as expected. However, the whole Transformation fails with a Runtime Error in Oxygen:
So, the try/catch Expression has not the desired result (which would be success and a copy of the input document).
Is this a bug, or do i miss something?
Sincerely,
Frank Steimke
i have a very simple XSLT transformation data.xsl. Inside, a boolean attribute is calculated as a comparison of a given value timestamp against current-dateTime. So timestamp has to be of type xs:dateTime. Transformation will fail with a runtime error if the input document is not validatend against a corresponding XSD Schema.
Next, i wrote an xsl stylesheet which calls fn:transform to invoke the transformation in data.xsl like this:
Code: Select all
<xsl:template match="document-node(element(input))">
<xsl:variable name="options" as="map(*)">
<xsl:map>
<xsl:map-entry key="'source-node'" select="."/>
<xsl:map-entry key="'stylesheet-node'" select="doc('data.xsl')"/>
</xsl:map>
</xsl:variable>
<xsl:try>
<xsl:sequence select="transform($options)('output')"/>
<xsl:catch>
<xsl:message>Runtime Error</xsl:message>
<xsl:copy-of select="."/>
</xsl:catch>
</xsl:try>
</xsl:template>
Code: Select all
System ID: C:\tmp\xslt-try\data.xsl
Scenario: main
XSL file: C:\tmp\xslt-try\main.xsl
XML file: C:\tmp\xslt-try\input.xml
Engine name: Saxon-EE 9.7.0.15
Severity: fatal
Description: XPTY0004: Cannot compare xs:untypedAtomic to xs:dateTime
URL: http://www.w3.org/TR/xpath20/#ERRXPTY0004
Is this a bug, or do i miss something?
Sincerely,
Frank Steimke