Project

Profile

Help

Bug #3475

Problem with SEF generated using Oxygen 19.1 "Compile XSLT Saxon 9.8" add-on

Added by David Priest about 1 year ago. Updated 8 months ago.

Status:
Closed
Priority:
Normal
Sprint/Milestone:
-
Start date:
2017-10-06
Due date:
% Done:

0%

Applies to JS Branch:
Fix Committed on JS Branch:
Fixed in JS Release:
SEF Generated with:
Company:
-
Contact person:
-
Additional contact persons:
-

Description

SaxonEE 9.7 and 9.8 when compiling XSL to SEF are behaving differently. Specifically, 9.8 is failing to run:

Salient details following:

In my HTML header:

<script type="text/javascript"> window.onload = function() { SaxonJS.transform({
            stylesheetLocation: "/xsl/kickstart.sef", initialTemplate: "kickstart"
            }); } </script>

In my XSL:

<xsl:transform extension-element-prefixes="ixsl" version="3.0"
    xmlns:ixsl="http://saxonica.com/ns/interactiveXSLT" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template name="kickstart">
        <xsl:message>KICKSTARTED BROWSER</xsl:message>
        <xsl:apply-templates select="ixsl:page()"/>
        <xsl:message>KICKSTOPPED BROWSER</xsl:message>
    </xsl:template>

    <xsl:template match="/html/head/title">
        <xsl:message>MATCHING TITLE</xsl:message>
        <ixsl:set-attribute name="title" select="'SHAZAM!'"/>
    </xsl:template>
</xsl:transform>

Compiling to SEF using the OxygenXML plugin:

With 9.7, success:

[Log] Saxon-JS 1.0.2 in browser (SaxonJS.min.js, line 1)
[Log] Transform options supplied: stylesheetLocation, initialTemplate,  (SaxonJS.min.js, line 1)
[Log] SEF generated by Saxon-EE version 9.7.0.20 with -target:JS -relocate:false (SaxonJS.min.js, line 1)
[Log] xsl:message:  KICKSTARTED BROWSER (SaxonJS.min.js, line 1)
[Log] xsl:message:  MATCHING TITLE (SaxonJS.min.js, line 1)
[Log] xsl:message:  KICKSTOPPED BROWSER (SaxonJS.min.js, line 1)

With 9.8, failure:

[Log] Saxon-JS 1.0.2 in browser (SaxonJS.min.js, line 1)
[Log] Transform options supplied: stylesheetLocation, initialTemplate,  (SaxonJS.min.js, line 1)
[Log] SEF generated by Saxon-EE version 9.8.0.4 with -target:JS -relocate:false (SaxonJS.min.js, line 1)
[Log] xsl:message:  KICKSTARTED BROWSER (SaxonJS.min.js, line 1)
[Error] TypeError: null is not an object (evaluating 't.tagName')
    V (SaxonJS.min.js:3:19218)
    next (SaxonJS.min.js:4:31890)
    next (SaxonJS.min.js:4:31795)
    next (SaxonJS.min.js:4:31795)
    next (SaxonJS.min.js:4:31795)
    next (SaxonJS.min.js:5:3852)
    forEachItem (SaxonJS.min.js:4:30051)
    ot (SaxonJS.min.js:3:23897)
    c (SaxonJS.min.js:1:4675)
    o (SaxonJS.min.js:1:5319)
    (anonymous function) (SaxonJS.min.js:1:6112)
    n (SaxonJS.min.js:1:14209)
    (anonymous function) (SaxonJS.min.js:1:14108)
    onload (SaxonJS.min.js:1:13831)
test.html (448 Bytes) David Priest, 2017-10-15 03:12 test.html
test.sef (2.64 KB) Generated using "Compile XSLT Saxon 9.8" button in Oxygen XML (latest edition) David Priest, 2017-10-15 03:12 test.sef
test.xsl (590 Bytes) David Priest, 2017-10-15 03:12 test.xsl

History

#1 Updated by Michael Kay about 1 year ago

  • Project changed from Saxon-CE to Saxon-JS
  • Assignee set to Debbie Lockett

#2 Updated by Debbie Lockett about 1 year ago

Thanks for reporting your issue, and providing the code sample. However I have not been able to reproduce the problem you are seeing. The code works as intended for me (i.e. no failures) when I use SEFs generated (from the provided XSLT) by 9.7.0.20, and 9.8.0.4.

Which browser are you using? (Though I assume you see the failure on different browsers?)

Is the console failure stack trace you have provided produced from an SEF generated by exactly this XSLT stylesheet?

Please could you run again with the non-minified version of Saxon-JS (i.e. SaxonJS.js rather than SaxonJS.min.js) and send the failure log in that case?

#3 Updated by David Priest about 1 year ago

HTML:

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>SaxonJS 9.8 Test</title>
        <script src="/js/SaxonJS.js"></script>
        <script type="text/javascript"> window.onload = function() { SaxonJS.transform({
            stylesheetLocation: "/xsl/test.sef", initialTemplate: "kickstart", initialMode: "html"
            }); } </script>
    </head>
    <body id="body">SaxonJS 9.8 Test</body>
</html>

XSL:

<xsl:transform extension-element-prefixes="ixsl" version="3.0" 
    xmlns:ixsl="http://saxonica.com/ns/interactiveXSLT" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template name="kickstart">
        <xsl:message>KICKSTARTED BROWSER</xsl:message>
        <xsl:apply-templates select="ixsl:page()"/>
        <xsl:message>KICKSTOPPED BROWSER</xsl:message>
    </xsl:template>

    <xsl:template match="/html/head/title">
        <xsl:message>MATCHING TITLE</xsl:message>
        <ixsl:set-attribute name="title" select="'SHAZAM!'"/>
    </xsl:template>
</xsl:transform>

Safari:

[Error] TypeError: null is not an object (evaluating 'expr.tagName')
    evaluateWithoutTrace (SaxonJS.js:7294)
    next (SaxonJS.js:8694)
    next (SaxonJS.js:8683)
    next (SaxonJS.js:8683)
    next (SaxonJS.js:8683)
    next (SaxonJS.js:9178)
    forEachItem (SaxonJS.js:8479)
    makeComplexContent (SaxonJS.js:7671)
    applyStylesheet (SaxonJS.js:16944)
    go (SaxonJS.js:17034)
    (anonymous function) (SaxonJS.js:17065)
    arrayDocFn (SaxonJS.js:96)
    (anonymous function) (SaxonJS.js:73)
    onload (SaxonJS.js:45)

Chrome:

SaxonJS.js:518 Saxon-JS 1.0.2 in browser
SaxonJS.js:518 Transform options supplied: stylesheetLocation, initialTemplate, initialMode, 
SaxonJS.js:518 SEF generated by Saxon-EE version 9.8.0.4 with -target:JS -relocate:false
SaxonJS.js:512 xsl:message:  KICKSTARTED BROWSER
SaxonJS.js:7294 Uncaught TypeError: Cannot read property 'tagName' of null
    at Object.evaluateWithoutTrace [as evaluate] (SaxonJS.js:7294)
    at Mode._processItem (SaxonJS.js:8418)
    at OneToMany._mapper (SaxonJS.js:8336)
    at OneToMany.next (SaxonJS.js:8694)
    at OneToMany.next (SaxonJS.js:8683)
    at OneToMany.next (SaxonJS.js:8683)
    at OneToMany.next (SaxonJS.js:8683)
    at Block.next (SaxonJS.js:9178)
    at Block.forEachItem (SaxonJS.js:8479)
    at Object.makeComplexContent (SaxonJS.js:7671)
evaluateWithoutTrace @ SaxonJS.js:7294
_processItem @ SaxonJS.js:8418
(anonymous) @ SaxonJS.js:8336
OneToMany.next @ SaxonJS.js:8694
OneToMany.next @ SaxonJS.js:8683
OneToMany.next @ SaxonJS.js:8683
OneToMany.next @ SaxonJS.js:8683
Block.next @ SaxonJS.js:9178
forEachItem @ SaxonJS.js:8479
makeComplexContent @ SaxonJS.js:7671
applyStylesheet @ SaxonJS.js:16944
go @ SaxonJS.js:17034
(anonymous) @ SaxonJS.js:17065
arrayDocFn @ SaxonJS.js:96
(anonymous) @ SaxonJS.js:73
xhr.onload @ SaxonJS.js:45
XMLHttpRequest.send (async)
asyncGet @ SaxonJS.js:54
asyncGetXml @ SaxonJS.js:65
asyncGetMultipleXml @ SaxonJS.js:102
transform @ SaxonJS.js:17062
window.onload @ test:5

#4 Updated by Debbie Lockett about 1 year ago

  • Status changed from New to In Progress

Thanks for the update and attachments, David. Indeed I can now replicate the problem using the SEF you supplied. There does seem to be something wrong with this SEF which I need to investigate. Specifically, the templateRule element only has one child; it is missing a second child called sequence (and attribute role="action").

By generating the SEF on the command line using 9.8.0.4 I do not see this problem. So it seems that something is wrong using the Oxygen button - I need to investigate this.

#5 Updated by Radu Coravu about 1 year ago

Debbie contacted us, the Oxygen developers about this.

With Oxygen 19.1 (which comes with Saxon 9.7.0.19) and its builtin action for XSLT to SEF conversion (Tools menu->Compile XSLT Stylesheet to Saxon) the generated SEF file properly seems to contain that sequence which is missing in your case.

But indeed if you install in Oxygen the add-on which adds Saxon 9.8 support and which adds an extra toolbar button for XSLT to SEF, indeed converting using that button seems to not generate that sequence. So there is probably something wrong with how our add-on uses Saxon for the SEF generation. If we manage to fix this and release a new add-on version, I will update this thread.

#6 Updated by Debbie Lockett about 1 year ago

  • Subject changed from Saxon 9.8 compilation crashes with Saxon-JS 1.0.2 given a very simple transformation to Problem with SEF generated using Oxygen 19.1 "Compile XSLT Saxon 9.8" add-on

#7 Updated by Michael Kay about 1 year ago

To add a little detail here: the SEF file contains an empty template body. We see in the Saxon code that it's possible to generate this if the template has not yet been compiled. Saxon-EE 9.8 uses just-in-time template rule compilation by default, but we suppress this if you request an export file. We suspect that oXygen is invoking Saxon in such a way that we have this invalid combination of options (JIT compilation plus export). Saxon should probably detect this situation and fix it, but we first need to see exactly what's happening. You may be able to circumvent the problem at the oXygen level by disabling JIT compilation.

#8 Updated by Debbie Lockett about 1 year ago

Following a prompt from my Oxygen Editor today, I updated to the latest release of Oxygen 19.1 (build ID 2017102417). The release notes indicate that this bug has been addressed:

"Add-ons/Saxon-EE 9.8: In some cases, stylesheet compilation using Saxon-JS was generating incomplete output so JIT compilation was disabled: https://saxonica.plan.io/issues/3475." (see https://www.oxygenxml.com/build_history.html#2017102417)

However I still get the same problematic SEF output when using the "Compile XSLT Saxon 9.8" toolbar button for XSLT to SEF.

The Oxygen add-on manager said there was no update for the "Saxon 9.8 XSLT & XQuery processor" add-on, but I uninstalled and reinstalled anyway to be sure. Should there be an update available?

#9 Updated by Debbie Lockett about 1 year ago

  • Status changed from In Progress to Resolved

An update to the "Saxon 9.8 XSLT & XQuery processor" add-on is now available, version 19.1.1. The bug is indeed now fixed.

#10 Updated by Debbie Lockett 8 months ago

  • Status changed from Resolved to Closed

Belatedly closing this issue. No Saxon fix was required - this was purely an Oxygen problem (now resolved).

Please register to edit this issue

Also available in: Atom PDF Tracking page