Created
March 22, 2012 05:30
-
-
Save ebruchez/2156397 to your computer and use it in GitHub Desktop.
Prototype for XBL component with binding to optional element
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:xhtml="http://www.w3.org/1999/xhtml" | |
xmlns:xforms="http://www.w3.org/2002/xforms" | |
xmlns:ev="http://www.w3.org/2001/xml-events" | |
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" | |
xmlns:fr="http://orbeon.org/oxf/xml/form-runner" | |
xmlns:oxf="http://www.orbeon.com/oxf/processors" | |
xmlns:xbl="http://www.w3.org/ns/xbl" | |
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"> | |
<xbl:binding id="fr-optional-element" element="fr|optional-element" xxbl:mode="binding handlers" xxbl:container="span"> | |
<xbl:template> | |
<xforms:group appearance="xxforms:internal"> | |
<!-- Content such as xforms:input --> | |
<xbl:content/> | |
<!-- Insert element if missing --> | |
<xforms:action ev:event="xforms-enabled" ev:target="#observer"> | |
<xforms:var name="ref" xbl:attr="xbl:text=ref"/> | |
<xforms:var name="name" value="tokenize($ref, '/')[last()]"/> | |
<xforms:insert | |
if="not(exists(xxforms:binding('fr-optional-element'))) and $name castable as xs:NCName" | |
context="xxforms:component-context()" | |
ref="*" | |
origin="xxforms:element($name)"/> | |
</xforms:action> | |
</xforms: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