Saxon-Forms icon indicating copy to clipboard operation
Saxon-Forms copied to clipboard

Data Mutation: Remove Nodeset Fails

Open JDziurlaj opened this issue 2 years ago • 0 comments

In testing XForms 1.1 spec, example B.7, Saxon-Forms fails with the following error:

Uncaught 
Object { message: "Required cardinality of second operand of 'is' is zero or one; supplied value contains 3 items (element <track>, element <track>,... )", stack: "I@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4102:51\nB@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4685:327\ncheck/Od@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4686:274\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:322\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nD/Le/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:528\nD/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:501\nD/Le/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:528\nD/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:501\ncallT/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4434:374\nchoose/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4435:41\nD/Le/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:528\nD/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:501\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nchoose/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4435:41\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nD/Le/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:528\nD/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:501\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nD/Le/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:528\nD/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:501\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nD/Le/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:528\nD/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:501\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nD/Le/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:528\nD/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:501\nD/Le/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:528\nD/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:501\ncallT/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4434:374\nforEach/Le/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4438:110\nca.forEachItem@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4229:390\nforEach/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4438:80\nchoose/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4435:41\nD/Le/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:528\nD/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:501\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nchoose/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4435:41\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nD/Le/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:528\nD/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:501\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nD/Le/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:528\nD/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:501\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nD/Le/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:528\nD/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:501\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nD/Le/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:528\nD/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:501\nD/Le/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:528\nD/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:501\ncallT/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4434:374\nchoose/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4435:41\nchoose/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4435:41\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nforEach/Le/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4438:110\nca.forEachItem@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4229:390\nforEach/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4438:80\nlet/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4443:353\nD/Le/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:528\nD/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:501\nD/Le/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:528\nD/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4416:501\ncallT/Le@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4434:374\npush@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4446:401\nbf@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:5054:330\nLb/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:5052:192\nca.forEachItem@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4229:390\nLb@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:5052:159\nbubble@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:5051:390\nbf@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:5054:416\nLb/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:5052:192\nca.forEachItem@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4229:390\nLb@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:5052:159\nY@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:5082:31\nEventListener.handleEvent*E@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:5082:308\nh/<@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:5082:465\nh@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:5082:417\nZ@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:5068:116\ng@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:5071:294\nm@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:5074:212\ntransform@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:5094:341\nwindow.onload@http://localhost:9080/demos/demo-repro.html:12:17\nEventHandlerNonNull*@http://localhost:9080/demos/demo-repro.html:11:7\n", name: "XError", code: "XPTY0004", xsltLineNr: "4406", xsltModule: "file:/C:/Users/John/Documents/GitHub/Saxon-Forms/src/saxon-xforms.xsl" }
SaxonJS2.js:4446:461
<xforms:xform xmlns:rest="http://exquery.org/ns/restxq" xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms"
    xmlns:demo="urn:saxon-xforms:demo">
    <xforms:model id="m-recipes">
        <!-- B.7 -->
        <xforms:instance>
            <playlist xmlns="">
                <name>Music for Airports</name>
                <track id="382"/>
                <track id="461"/>
                <track id="629"/>
            </playlist>
        </xforms:instance>
        <!--do not change -->
        <xforms:submission id="test" ref="." instance="hello"/>
    </xforms:model>
    <div id="content">
        <xforms:trigger>
            <xforms:label>Test it</xforms:label>
            <xforms:action ev:event="DOMActivate">
                <xforms:delete nodeset="track"/>
            </xforms:action>
        </xforms:trigger>
        <xforms:submit submission="test">
            <xforms:label>Export Subset</xforms:label>
        </xforms:submit>
    </div>
</xforms:xform>

Note that I am not using the SEF included with the repo; however, I am using a newly compiled version from an unmodified saxon-xforms.xsl using Oxygen's Compile XSL stylesheet for Saxon (Oxygen 25.0, 2022101006) and running using SaxonJS-2.5 on Firefox 108.0 (Windows)

JDziurlaj avatar Dec 15 '22 12:12 JDziurlaj