Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Mutation: Set Attribute Fails #22

Open
JDziurlaj opened this issue Dec 15, 2022 · 0 comments
Open

Data Mutation: Set Attribute Fails #22

JDziurlaj opened this issue Dec 15, 2022 · 0 comments

Comments

@JDziurlaj
Copy link

In testing XForms 1.1 spec, example B.4, 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:

<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.4 -->
        <xforms:instance>
            <items xmlns="">
                <item key="23" rating="classified"/>
                <item key="42"/>
                <item key="68" rating="unknown"/>
            </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:insert context="item[3]" origin="../item[1]/@rating"/>
            </xforms:action>
        </xforms:trigger>
        <xforms:submit submission="test">
            <xforms:label>Export Subset</xforms:label>
        </xforms:submit>
    </div>
</xforms:xform>

See also #19

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant