RE: XForms and xsd:ID

Hi again,

With regards attempting to generate unique id values;

I have tried a couple of other possibles (using X-Smiles and the Novell browser only) for generating values:

Both of these simply overwrite all id values, which is okay if there are no IDREFs floating about. The nodeset expression could be refined to include only id attributes with no value in a real application.

1. 
<xfm:model id="test" schema="file://c:/projects/xforms/id.xsd">
	<xfm:instance id="instance1" src="id.xml"/>
	<xfm:bind nodeset="//@id" calculate="concat('id', position())"/>
</xfm:model>

<xfm:repeat nodeset="/my_root/my_element" id="element">
	<xfm:input ref=".">
		<xfm:label class="captionTextLeft">Literal Value:</xfm:label>
	</xfm:input>
</xfm:repeat>


Here is the instance:

<my_root>
	<my_element id="a1">source</my_element>
	<my_element id="a2">Bob</my_element>
</my_root>


Apologies if there are any syntax errors, they are most likely cut-and-paste problems.

I had hoped that this would just give me an incrementing number as the bind interates through the nodeset (just like in XSLT).

I have tried this in the Novell and X-Smiles browsers. I do not get the hoped for results in either, though to be honest, I am not really sure what I should expect. 

I have just been told by Mikko Honkala that for X-Smiles: "The calculated expression is executed for each of the nodes in the nodeset separately. So at execution state, I think, position() will always return '1'." So clearly it will not work there.

Which of us is correct? Am I making too many XSLT/XPath based assumptions about what a nodeset is in the context of XForms? 

NB the X-Smiles browser requires you to put XForms functions within the XForms namespace, while the Novell browser requires you not to.

Any other suggestions gratefully received.

All the best

Mark Seaborne

Received on Monday, 2 December 2002 07:16:18 UTC