Project

Profile

Help

Bug #4734

SaxonJS.transform nonInteractive option does not work

Added by Debbie Lockett 11 days ago. Updated 2 days ago.

Status:
Resolved
Priority:
Normal
Category:
API
Sprint/Milestone:
-
Start date:
2020-09-14
Due date:
% Done:

0%

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

Description

See original problem raised in Issue #4732.

When more than one SaxonJS.transform call is used in an application, event listeners are registered again; and it seems that use of "nonInteractive": true has no effect:

As explained on the mailing list, I am trying to replicate the behavior of Saxon-CE's updateHTMLDocument() with Saxon-JS 2. This code is invoked from a JS onsubmit handler in order to replace the content of the submitted form:

SaxonJS.transform({
    "stylesheetLocation":
"https://localhost:4443/static/com/atomgraph/linkeddatahub/xsl/client.xsl.sef.json",
    "initialMode":
"Q{https://w3id.org/atomgraph/linkeddatahub/domain#}ConstructViolation",
    "logLevel": 10,
    "sourceNode": html, // HTML document node from a jqXHR response
    "templateParams": {
        "submitted-form": form // the onsubmit target
    },
    "destination": "raw",
    "nonInteractive": true
}, "async");
<xsl:template match="html" mode="apl:ConstructViolation">
    <xsl:param name="submitted-form" as="element()"/>
    <xsl:variable name="violation-form" as="element()">
    ...
    </xsl:variable>

    <xsl:result-document href="#{$submitted-form/@id}" method="ixsl:replace-content">
        <xsl:copy-of select="$violation-form/*"/>
    </xsl:result-document>
</xsl:template>

However with each invocation it looks like the ixsl: event listeners are being registered again. [...] there's another "main" SaxonJS.transform() that already has registered the listeners. I thought I could switch this off using "nonInteractive": true, but it does not seem to have the desired effect.

History

#1 Updated by Martynas Jusevicius 3 days ago

Do you need a test case for this or were you able to reproduce it?

#2 Updated by Debbie Lockett 2 days ago

  • Subject changed from Events registered multiple times when more than one SaxonJS.transform call to SaxonJS.transform nonInteractive option does not work
  • Category changed from Internals to API
  • Status changed from New to In Progress

The SaxonJS.transform option nonInteractive is simply not fully implemented, and was untested.

Currently the option is not being processed during checkOptions, so it is simply lost. Also subsequent options checks must use dot notation to access the property, not bracket notation; else these won't work following renaming (from Closure compiling).

JS2 unit tests being added (API/nonInteractive01, etc.)

#3 Updated by Debbie Lockett 2 days ago

  • Status changed from In Progress to Resolved
  • Fix Committed on JS Branch 2.0 added

Code fix, and JS2 unit tests, committed.

Please register to edit this issue

Also available in: Atom PDF Tracking page