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

ID/IDREF relationships in XML instances

From: Mark Seaborne <MSeaborne@origoservices.com>
Date: Mon, 18 Nov 2002 13:57:42 -0000
Message-ID: <DC65AE678B89004B9CCB202E19482CC704FB6B@mail.origoservices.local>
To: <XForms@yahoogroups.com>, <www-forms@w3.org>

Hi

I am trying to author a simple XForms form that allows someone to edit the following:

	<address id="c">
		<line_1>4 Heronimous Road</line_1>
		<line_2>Skegness</line_2>
		<line_3/>
		<line_4/>
		<postcode>SK1 1KS</postcode>
	</address>
	<person id="1">
		<forenames>Harold</forenames>
		<surname>Biggs</surname>
		<address address_id="c"/>
	</person>

There can be more than one <person>, more than one <address> and more than one person/@address_id can point to one address/@id.

First off, I want to build a form that displays a <person>, along with its associated <address>.

This must be a fairly simple job, but I am afraid I have been looking at it for too long to see how to accomplish it.

Might something along the following lines work? 

I have tried the index() function, hoping it will give me the current <person> in the <xfm:repeat>. I am not convinced that I am using it correctly though:

		<xfm:repeat nodeset="person" id="people">
			<!-*person details here*-->
			<xfm:group id="address" 
			ref="../address[@id = ../person[index('people')]/address/address_id]">
			<!-*Address here-->
			</xsf:group>
		</xfm:repeat>

Any ideas, or pointers to relevant examples would be much appreciated.

All the best

Mark Seaborne
Received on Monday, 18 November 2002 09:39:43 GMT

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