XSL try/catch does not prevent runtime error in Oxygen

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
fsteimke
Posts: 41

XSL try/catch does not prevent runtime error in Oxygen

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:

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>

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:

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

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
Radu
Posts: 5858

Re: XSL try/catch does not prevent runtime error in Oxygen

Fri Dec 22, 2017 4:08 pm

Hi Frank,

What exact version of Oxygen are you using? You should first try upgrading to the latest 19.1.
If you still have problems please send us (support@oxygenxml.com) a complete small sample (XML + XSL) to reproduce the problem on our side.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
fsteimke
Posts: 41

Re: XSL try/catch does not prevent runtime error in Oxygen

Fri Dec 22, 2017 7:09 pm

Hi Radu,

sorry, i forgot. It was 19.0 an Windows 10 32 bit. Same thing after upgrading to 19.1. I will send the whole project to the support address.

Thanks,
Frank
Radu
Posts: 5858

Re: XSL try/catch does not prevent runtime error in Oxygen

Wed Jan 03, 2018 5:07 pm

Hi Frank,

Thanks for the samples, I can reproduce the problem on my side and indeed Oxygen should not report the transformation as failed in this case. I will add an internal issue to look into this and we'll update this forum thread when we find a fix for this, probably in a future Oxygen version.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Radu
Posts: 5858

Re: XSL try/catch does not prevent runtime error in Oxygen

Mon Mar 19, 2018 1:37 pm

Hi Frank,

The Oxygen XML Editor version 20 we just released should have a fix for your reported problem. It also comes bundled with Saxon 9.8.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Return to “Common Problems”

Who is online

Users browsing this forum: No registered users and 3 guests