Last active
August 29, 2015 13:56
-
-
Save ebruchez/9194679 to your computer and use it in GitHub Desktop.
XBL component to edit dcterms:spatial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xbl:xbl xmlns:xh="http://www.w3.org/1999/xhtml" | |
xmlns:xf="http://www.w3.org/2002/xforms" | |
xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
xmlns:xxf="http://orbeon.org/oxf/xml/xforms" | |
xmlns:fr="http://orbeon.org/oxf/xml/form-runner" | |
xmlns:xbl="http://www.w3.org/ns/xbl" | |
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"> | |
<xbl:binding id="fr-latlong" element="fr|latlong" xxbl:container="span" xxbl:mode="lhha binding value" xxbl:label-for="input1"> | |
<!-- Local model --> | |
<xbl:implementation> | |
<xf:model> | |
<xf:instance> | |
<latlong> | |
<lat/> | |
<long/> | |
</latlong> | |
</xf:instance> | |
</xf:model> | |
</xbl:implementation> | |
<xbl:template> | |
<!-- Read value upon creation and update --> | |
<xf:var name="binding" value="string(xxf:binding('fr-latlong'))"> | |
<xf:action event="xforms-enabled xforms-value-changed"> | |
<xf:setvalue ref="instance()/lat" value="substring-before(substring-after($binding, 'north='), ';')"/> | |
<xf:setvalue ref="instance()/long" value="substring-before(substring-after($binding, 'east='), ';')"/> | |
</xf:action> | |
</xf:var> | |
<xf:group> | |
<!-- Two separate fields --> | |
<xf:input ref="lat"> | |
<xf:label>Latitude</xf:label> | |
</xf:input> | |
<xf:input ref="long"> | |
<xf:label>Longitude</xf:label> | |
</xf:input> | |
<!-- Write value upon local updates --> | |
<xf:setvalue | |
event="xforms-enabled xforms-value-changed" | |
ref="xxf:binding('fr-latlong')" | |
value="concat('east=', instance()/long, '; north=', instance()/lat, ';')"/> | |
</xf:group> | |
</xbl:template> | |
</xbl:binding> | |
</xbl:xbl> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment