Skip to content

Instantly share code, notes, and snippets.

@avernet
Created November 10, 2016 00:09
Show Gist options
  • Save avernet/b73d2e59cc97ada3bf1e12ebf2b037b4 to your computer and use it in GitHub Desktop.
Save avernet/b73d2e59cc97ada3bf1e12ebf2b037b4 to your computer and use it in GitHub Desktop.
Itemset pointing to non-relevant nodes (Form Builder)
<xh:html 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:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder">
<xh:head>
<xh:title>Untitled Form</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<!-- Main instance -->
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<section>
<colors>blue</colors>
<show-unreasonable>true</show-unreasonable>
</section>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-bind" name="section" ref="section">
<xf:bind id="colors-bind" ref="colors" name="colors"/>
<xf:bind id="show-unreasonable-bind" ref="show-unreasonable" name="show-unreasonable"
type="xf:boolean"/>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>a</application-name>
<form-name>a</form-name>
<title xml:lang="en">Untitled Form</title>
<description xml:lang="en"/>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>
<!-- All form resources -->
<xf:instance id="fr-form-resources" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<colors>
<label>Colors</label>
<hint/>
<item>
<label>Blue</label>
<hint/>
<value>blue</value>
</item>
<item>
<label>Red</label>
<hint/>
<value>red</value>
</item>
</colors>
<show-unreasonable>
<label>Show unreasonable</label>
<hint/>
</show-unreasonable>
<section>
<label>Section</label>
</section>
</resource>
</resources>
</xf:instance>
<xf:bind ref="instance('fr-form-resources')/resource/colors/item[value = 'red']"
relevant="instance('fr-form-instance')/section/show-unreasonable/string() = 'true'"/>
<!-- Utility instances for services -->
<xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all">
<request/>
</xf:instance>
<xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all">
<response/>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors">
<fr:section id="section-control" bind="section-bind">
<xf:label ref="$form-resources/section/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<xf:select1 id="colors-control" appearance="full" bind="colors-bind">
<xf:label ref="$form-resources/colors/label"/>
<xf:hint ref="$form-resources/colors/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="$form-resources/colors/item">
<xf:label ref="label"/>
<xf:value ref="value"/>
<xf:hint ref="hint"/>
</xf:itemset>
</xf:select1>
</xh:td>
<xh:td>
<fr:yesno-input xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
id="show-unreasonable-control"
bind="show-unreasonable-bind">
<xf:label ref="$form-resources/show-unreasonable/label"/>
<xf:hint ref="$form-resources/show-unreasonable/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:yesno-input>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment