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

Cannot insert attributes to existing node #19

Open
JDziurlaj opened this issue Dec 13, 2022 · 1 comment
Open

Cannot insert attributes to existing node #19

JDziurlaj opened this issue Dec 13, 2022 · 1 comment

Comments

@JDziurlaj
Copy link

Per XForms 1.1, I should be able to copy attributes into tags defined in the xf:model. However, when attempting this, I get the following error:

message: "Cannot write attribute (Q{}optional=true) after writing child nodes (level=3, start tag = demo:ingredient)...name: "XError", code: "XTDE0410", xsltLineNr: "2105", xsltModule: "file:/C:/Users/John/Documents/GitHub/Saxon-Forms/src/saxon-xforms.xsl" }

The trigger is defined as:

<xf:trigger>
	<xf:label>Make ingredient optional</xf:label>
	<xf:action ev:event="DOMActivate">
		<xf:insert context="." nodeset="demo:ingredients/demo:ingredient" origin="instance('i-optional')/@optional"/>
		<xf:setfocus control="edit-ingredient-repeat-input"/>
	</xf:action>
</xf:trigger>

Where i-optional is defined as

<xf:instance id="i-optional">
	<demo:ingredient optional="true"/>
</xf:instance>

See also https://gist.github.com/JDziurlaj/437ef86eaac38f4dc83c6bdef49d829e
Running SaxonJS 2.5

@JDziurlaj
Copy link
Author

As a workaround I can get this to function if I specify position="child" for xf:insert which seems to avoid the problematic copy-of in the XSLT.

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