I am using Orbeon Form Builder to generate a form. I would like to delete an element (last one) from the model when the form is saved.
I have tried to create a delete action base on the examples in this link but cannot get it to work
Given the instance
<xf:instance id="fr-form-instance">
<guide>
<title/>
<media>
<format>image</format>
</media>
<media>
<format>video</format>
</media>
</guide>
</xf:instance>
I have the following delete action within my to delete the last media element
<xf:delete ev:event="xforms-submit" nodeset="guide/media" at="last()"/>
But it does not work.
I have also tried changing the xpath
<xf:delete ev:event="xforms-submit" nodeset="media" at="last()"/>
and wrapping in an action
<xf:action ev:event="xforms-submit">
<xf:delete nodeset="guide/media" at="last()"/>
</xf:action>
but still no joy!
The XForm is valid and you can save the data, it's just that the second media element still appears in the final XML data.