ID/IDREF relationships in XML instances

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 UTC