W3C home > Mailing lists > Public > www-forms@w3.org > February 2014

Re: Get the values of an element and combine them

From: Steven Pemberton <Steven.Pemberton@cwi.nl>
Date: Mon, 24 Feb 2014 17:50:58 +0100
To: public-xformsusers@w3.org, www-forms@w3.org, "Jean-Baptiste Pressac" <Jean-Baptiste.Pressac@univ-brest.fr>
Message-ID: <op.xbso282jsmjzpq@steven-ux21a>
Here is an example of how I would do it:

	http://www.cwi.nl/~steven/forms/dcterms.xml

I'm not sure of all the requirements of your problem, but what I do is:

	1. At initialisation, extract the values of east and north from your  
input spatial value:

	    <action ev:event="xforms-ready">
		<setvalue ref="east"  
value="substring-before(substring-after(instance('in')/spatial, 'east='),  
';')"/>
		<setvalue ref="north"  
value="substring-before(substring-after(instance('in')/spatial, 'north='),  
';')"/>
	    </action>

	2. Bind a calculation to the output spatial value:

	    <bind ref="spatial" calculate="concat('east=', ../east, '; north=',  
../north, ';')"/>

I hope this helps.

Steven Pemberton

On Thu, 20 Feb 2014 16:13:50 +0100, Jean-Baptiste Pressac  
<Jean-Baptiste.Pressac@univ-brest.fr> wrote:

> Hello,
> I would like to use Xform to edit the following element :
> <dcterms:spatial xsi:type="dcterms:Point">east=456;
> north=123;</dcterms:spatial>
>
> I could use :
> <xf:input ref="dcterms:spatial[@xsi:type='dcterms:Point']"
> class="dcterms:spatial">
>      <xf:label>Latitude / Longitude:</xf:label>
> </xf:input>
>
> But is there a way to display two inputs to let the user enter the east
> value and the north value separately ?
>
> Thanks,
Received on Monday, 24 February 2014 16:51:34 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:26 UTC