Skip to content

Instantly share code, notes, and snippets.

@ebruchez
Created August 21, 2010 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebruchez/541554 to your computer and use it in GitHub Desktop.
Save ebruchez/541554 to your computer and use it in GitHub Desktop.
<xhtml:html xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:f="http://orbeon.org/oxf/xml/formatting" xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:widget="http://orbeon.org/oxf/xml/widget"
xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes"
xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:fr="http://orbeon.org/oxf/xml/form-runner">
<xhtml:head>
<xforms:model id="main"
xxforms:session-heartbeat="true"
xxforms:show-error-dialog="false"
xxforms:external-events="submit-save submit-preview submit-cancel">
<xforms:instance id="instance">
<root>
<repeat>
<item>
<title/>
<node-selector/>
</item>
</repeat>
</root>
</xforms:instance>
<xforms:instance id="proto-property">
<item>
<title/>
<node-selector/>
</item>
</xforms:instance>
<xforms:bind nodeset="instance('instance')">
<xforms:bind
nodeset="repeat/item/title"
type="xs:boolean"
required="true()" />
<xforms:bind
nodeset="repeat/item/node-selector"
relevant="../title = 'true'" />
</xforms:bind>
</xforms:model>
<xbl:xbl xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
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:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xbl:script src="/apps/xforms-sandbox/samples/input-counted.js" />
<xbl:binding id="fr-input-counted" element="fr|input-counted">
<xbl:template xxbl:transform="oxf:unsafe-xslt">
<xsl:transform version="2.0">
<xsl:import href="oxf:/oxf/xslt/utils/xbl.xsl" />
<xsl:template match="/*">
<xforms:group xbl:attr="model context ref bind" xxbl:scope="outer">
<xbl:content includes="xforms|label" />
<xsl:copy-of select="xxbl:parameter(., 'max')" />
<xxforms:script ev:event="xforms-enabled">
YAHOO.xbl.fr.InputCounted.instance(this).init();
</xxforms:script>
<xforms:group xxbl:scope="inner">
<xxforms:variable name="binding" as="node()?">
<xxforms:sequence select="." xxbl:scope="outer"/>
</xxforms:variable>
<xforms:input id="input-counted" class="fr-input-counted" ref="$binding" incremental="true" />
<label class="counter-label"></label>
</xforms:group>
</xforms:group>
</xsl:template>
</xsl:transform>
</xbl:template>
</xbl:binding>
</xbl:xbl>
</xhtml:head>
<xhtml:body class="body">
<div>
<xforms:trigger appearance="full">
<xforms:label>
Add Another
</xforms:label>
<xforms:insert ev:event="DOMActivate"
nodeset="repeat/item"/>
</xforms:trigger>
</div>
<xforms:repeat nodeset="repeat/item">
<div>
<xforms:input id="title" ref="title">
<xforms:label>Make input relevant</xforms:label>
</xforms:input>
</div>
<div>
<fr:input-counted ref="node-selector" max="10">
<xforms:label>Node Selector </xforms:label>
</fr:input-counted>
</div>
</xforms:repeat>
</xhtml:body>
</xhtml:html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment