putting data in the right place

Hello again,

With Mark's help I was able to create a new instance structure when hitting a trigger. 
I now tried to combine this creation with a setvalue-action but failed.


I have the following syntax:

	<xforms:repeat nodeset="/tm:topicMap/tm:topic" id="topicRepeat" startindex="0"/>
	<xforms:input ref="/tm:topicMap/tm:topic/@id">
		<xforms:hint>Eindeutiger Wert zur Identifikation des Topics</xforms:hint>
	</xforms:input>
	<xforms:trigger id="insertbutton">
		<xforms:label>Topic hinzufügen</xforms:label>
		<xforms:action ev:event="click">
			<xforms:setvalue ref="xforms:if(count(/tm:topicMap//tm:topic)=1),/tm:topicMap/tm:topic[1]/@id,/tm:topicMap/tm:topic[last()-1]/@id" value="/tm:topicMap/tm:topic[last()]/@id"/>
			<xforms:insert nodeset="/tm:topicMap/tm:topic" at="xforms:index('topicRepeat')" position="after"/>
		</xforms:action>
	</xforms:trigger>

This code "should" do the following. As soon as I hit the trigger, the current value is saved in the previous topic-id. If there is just one topic within the instance data, the value should be stored in the single topic-id. After this setvalue action a new topic-structure should be created.
The problem with the code above is that the id value is always stored at the latest topic-id attribute.
Can you help me?

wbr,
Roman

Received on Friday, 6 December 2002 10:28:21 UTC