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

Nested repeat processing

From: Dan Dennedy <DDennedy@digitalbang.com>
Date: Tue, 11 Dec 2001 11:09:14 -0500
Message-ID: <C96072E096CC0D4EA606C1119F51858A01DB40@intrabang01.digitalbang.com>
To: "XForms (E-mail)" <www-forms@w3.org>
Hello, I am new to the list. I experiement with an XForms implementation
based upon the Java code Dominic Cooney posted here about a year ago. In
doing so, I have modified it to keep it fairly close the evolving spec.

In thing I implemented was nested repeat processing, but I want to
validate my approach. Here is my sample XForms UI code:

	<repeat nodeset="section">
		<group class="frame">
			<input ref="./title">
				<caption>Section Title</caption>
			</input>
			<repeat ref="." nodeset="div">
				<textarea ref="./.">
					<caption>Paragraph</caption>
				</textarea>
			</repeat>
		</group><br/>
	</repeat>

Notice the nested repeat has both ref and nodeset attributes. Also,
notice that the nested control, textarea, has two current context
references (dots). When I unroll this on the first iteration, it
becomes, for example with 2 sections in my instance:

		<group class="frame">
			<input ref="section[1]/title">
				<caption>Section Title</caption>
			</input>
			<repeat ref="section[1]" nodeset="div">
				<textarea ref="section[1]/.">
					<caption>Paragraph</caption>
				</textarea>
			</repeat>
		</group><br/>
		<group class="frame">
			<input ref="section[2]/title">
				<caption>Section Title</caption>
			</input>
			<repeat ref="section[2]" nodeset="div">
				<textarea ref="section[2]/.">
					<caption>Paragraph</caption>
				</textarea>
			</repeat>
		</group><br/>

The second iteration of unrolling yields with 1 div in section 1 and 3
divs in section 2:
		<group class="frame">
			<input ref="section[1]/title">
				<caption>Section Title</caption>
			</input>
				<textarea ref="section[1]/div[1]">
					<caption>Paragraph</caption>
				</textarea>
		</group><br/>
		<group class="frame">
			<input ref="section[2]/title">
				<caption>Section Title</caption>
			</input>
				<textarea ref="section[2]/div[1]">
					<caption>Paragraph</caption>
				</textarea>
				<textarea ref="section[2]/div[2]">
					<caption>Paragraph</caption>
				</textarea>
				<textarea ref="section[2]/div[3]">
					<caption>Paragraph</caption>
				</textarea>
			</repeat>
		</group><br/>

Is this correct?
Received on Tuesday, 11 December 2001 11:09:14 GMT

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