W3C home > Mailing lists > Public > www-forms@w3.org > March 2009

RE: question about usage

From: Philip Fennell <Philip.Fennell@bbc.co.uk>
Date: Wed, 18 Mar 2009 08:18:38 -0000
Message-ID: <F3685F4A877F284F8054E328390447D14C6E3C@bbcxues17.national.core.bbc.co.uk>
To: <www-forms@w3.org>
Chris,

You can include, as you rightly suggest, a template (dummy) in a
xf:instance that you use as your source for an insert into your 'main'
instance document. The xf:insert action in XForms 1.1 lets you define
the source for the insert using the origin attribute. You'd also need to
use the instance() function to point to the 'template' instance.

A quick example:

<xf:insert	context="instance('entry')" 
		nodeset="atom:category" 
	
origin="instance('categories')/atom:category[index('tagSelector')]"/>

The 'entry' instance document is an atom:entry, the source for the
insert (origin) is the nth (according to the index of an xf:repeat
selection) atom:category element in the 'categories' instance document.
The target is the node-set binding to atom:category elements in the
'entry' instance. When no categories exist in the entry the insert
location node becomes the parent atom:entry.


Regards

Philip Fennell



-----Original Message-----
From: www-forms-request@w3.org [mailto:www-forms-request@w3.org] On
Behalf Of Howard, Chris
Sent: 17 March 2009 18:31
To: www-forms@w3.org
Subject: question about usage

This may not be an appropriate place for this question...

I'm trying to implement an invoice-type form using XForms.
I have the examples of inserting and deleting from repeating groups of
elements.

What do I do with an xml file that does not have any elements of some
optional type, where I then want the user to be able to insert some of
those elements?

Do I somehow load up a "dummy" xml document that contains spaceholders
for all of the optional elements and then merge that with my true data?

Looking for suggestions,
Chris





http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
					
Received on Wednesday, 18 March 2009 08:19:13 GMT

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