我找不到将重复节点值复制到另一个重复节点的好方法。在通用编程语言中,我的意思是将一个数组的内容复制到另一个数组。
<xforms:instance id="main-instance">
<contacts>
<contact>
<contact-id>111</contact-id>
<contact-name></contact-name>
<contact-location></contact-location>
</contact>
<contact>
<contact-id>222</contact-id>
<contact-name></contact-name>
<contact-location></contact-location>
</contact>
<contact>
<contact-id>333</contact-id>
<contact-name></contact-name>
<contact-location></contact-location>
</contact>
</contacts>
<alternate-contacts>
<contact>
<alt-contact-id></alt-contact-id>
<control-id></control-id>
<control-rules></control-rules>
<tranmission-method></tranmission-method>
</contact>
<contact>
<alt-contact-id></alt-contact-id>
<control-id></control-id>
<control-rules></control-rules>
<tranmission-method></tranmission-method>
</contact>
<contact>
<alt-contact-id></alt-contact-id>
<control-id></control-id>
<control-rules></control-rules>
<tranmission-method></tranmission-method>
</contact>
</alternate-contacts>
</xforms:instance>
当检查复选框(事件开始操作)时,我应该将第一contact-id
值复制到第一个值alt-contact-id
,依此类推。
<xforms:action ev:event="xforms-value-changed">
//TO DO here
</xforms:action>
请提供你的想法
编辑:所以当复选框被选中时,<alternate-contacts>
节点应该是这样的
<alternate-contacts>
<contact>
<alt-contact-id>111</alt-contact-id>
<control-id></control-id>
<control-rules></control-rules>
<tranmission-method></tranmission-method>
</contact>
<contact>
<alt-contact-id>222</alt-contact-id>
<control-id></control-id>
<control-rules></control-rules>
<tranmission-method></tranmission-method>
</contact>
<contact>
<alt-contact-id>333</alt-contact-id>
<control-id></control-id>
<control-rules></control-rules>
<tranmission-method></tranmission-method>
</contact>
</alternate-contacts>