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

Data Mutation: Move Attribute Fails

Open JDziurlaj opened this issue 2 years ago • 0 comments

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

Uncaught 
Object { message: "Required cardinality of value of variable $instance-with-insert is exactly one; supplied value contains 2 items (element <items>, attribute @rating='classified')", 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\ntreat/Od@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4736:115\nchoose/Od@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4686:487\ncheck/Od@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4686:29\ntreat/Od@http://localhost:9080/Saxon-JS-2.0/SaxonJS2.js:4736:115\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\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\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\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\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\n", name: "XError", code: "XTTE0570", xsltLineNr: "4312", 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.14 -->
        <xforms:instance>
            <items xmlns="">
                <item key="23" rating="classified"/>
                <item key="42"/>
            </items>
        </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:insert context="item[2]" origin="../item[1]/@rating"/>
                <xforms:delete nodeset="item[1]/@rating"/>
            </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