How to update an instance value with another document

91 views Asked by At

We are using XSLTForms and XSLT to display a page. I have an instance on a page whose value is set as a document.

<xf:instance id="myDetails">
        <xsl:copy-of select="$detailDocument" />
</xf:instance>

It works fine and the instance value is set correctly. However, later I need to update the value of this instance with another document. I tried something like follows but didn't work:

 <xf:setvalue ref="instance('myDetails')"><xsl:copy-of select="$updatedDetailDocument" /></xf:setvalue> 

This just makes the instance empty even though I know updatedDetailDocument is not empty. Does xf:setvalue even support setting instances ? Or is there any other way of doing the same ?

1

There are 1 answers

1
ebruchez On BEST ANSWER

<xf:setvalue> is used to set text within an XML attribute or XML element. In order to set a tree or subtree of XML, you would need the <xf:insert> action instead.

You don't say how you are getting $updatedDetailDocument, but since this is dynamic you probably need to retrieve that updated document using <xf:submission>, in which case you won't need <xf:insert> because <xf:submission> can directly update your instance with replace="instance".