W3C home > Mailing lists > Public > www-forms@w3.org > December 2002

RE: XForms and xsd:ID

From: Mark Seaborne <MSeaborne@origoservices.com>
Date: Mon, 2 Dec 2002 12:15:53 -0000
Message-ID: <DC65AE678B89004B9CCB202E19482CC704FB8F@mail.origoservices.local>
To: <www-forms@w3.org>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:21:54 GMT