<commit_before><!--
  Copyright (C) 2010 Orbeon, Inc.

  This program is free software; you can redistribute it and/or modify it under the terms of the
  GNU Lesser General Public License as published by the Free Software Foundation; either version
  2.1 of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the GNU Lesser General Public License for more details.

  The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
  -->
<group description="XForms XBL Components" xmlns:p="http://www.orbeon.com/oxf/pipeline"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xh="http://www.w3.org/1999/xhtml"
    xmlns:oxf="http://www.orbeon.com/oxf/processors"
    xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
    xmlns:xf="http://www.w3.org/2002/xforms"
    xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
    xmlns:xbl="http://www.w3.org/ns/xbl"
    xmlns:fr="http://orbeon.org/oxf/xml/form-runner">

    <test description="fr:inplace-input's hint evaluates in outer context" name="oxf:pipeline">
        <input name="config" href="wrap-xforms-state.xpl"/>
        <input name="document">
            <xh:html 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">
                <xh:head>
                    <xf:model id="model">
                        <xf:instance id="instance">
                            <instance>
                                <value/>
                                <label>Label me!</label>
                                <hint>Hint hint!</hint>
                            </instance>
                        </xf:instance>
                    </xf:model>
                    <xi:include href="oxf:/xbl/orbeon/inplace-input/inplace-input.xbl" xxi:omit-xml-base="true"/>
                </xh:head>
                <xh:body>
                    <xf:var name="my-hint" value="hint"/>
                    <fr:inplace-input id="my-inplace-input" ref="value">
                        <xf:label ref="../label"/>
                        <xf:hint ref="$my-hint"/>
                    </fr:inplace-input>
                </xh:body>
            </xh:html>
        </input>
        <output name="response">
            <xxf:event-response xmlns:xxf="http://orbeon.org/oxf/xml/xforms">
                <xxf:dynamic-state>
                    <dynamic-state>
                        <controls>
                            <control effective-id="my-inplace-input≡xf-4" case-id="fr-inplace-view"/>
                        </controls>
                    </dynamic-state>
                </xxf:dynamic-state>
                <xxf:action>
                    <xxf:control-values>
                        <xxf:control id="my-inplace-input" label="Label me!" hint="Hint hint!"/>
                        <xxf:control id="my-inplace-input≡xf-4" class="fr-component-group"/>
                        <xxf:div id="my-inplace-input≡fr-inplace-view" visibility="visible"/>
                        <xxf:div id="my-inplace-input≡fr-inplace-edit" visibility="hidden"/>
                        <xxf:control id="my-inplace-input≡xf-6" class="xforms-activable fr-inplace-hint">Hint hint!</xxf:control>
                        <xxf:control id="my-inplace-input≡xf-11" class="fr-inplace-content fr-inplace-edit"/>
                        <xxf:control id="my-inplace-input≡apply" label="Apply"/>
                        <xxf:control id="my-inplace-input≡xf-13" label="Cancel"/>
                    </xxf:control-values>
                </xxf:action>
            </xxf:event-response>
        </output>
    </test>

    <test description="fr:inplace-input pointing to readonly node" name="oxf:pipeline">
        <input name="config" href="wrap-xforms-state.xpl"/>
        <input name="document">
            <xh:html 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">
                <xh:head>
                    <xf:model id="model">
                        <xf:instance id="instance">
                            <instance>
                                <value>42</value>
                            </instance>
                        </xf:instance>
                        <xf:bind ref="value" readonly="true()"/>
                    </xf:model>
                    <xi:include href="oxf:/xbl/orbeon/inplace-input/inplace-input.xbl" xxi:omit-xml-base="true"/>
                </xh:head>
                <xh:body>
                    <fr:inplace-input id="my-inplace-input" ref="value">
                        <xf:label>Label me!</xf:label>
                        <xf:hint>Hint hint!</xf:hint>
                    </fr:inplace-input>
                </xh:body>
            </xh:html>
        </input>
        <output name="response">
            <xxf:event-response xmlns:xxf="http://orbeon.org/oxf/xml/xforms">
                <xxf:dynamic-state>
                    <dynamic-state>
                        <controls>
                            <control effective-id="my-inplace-input≡xf-4" case-id="fr-inplace-view"/>
                        </controls>
                    </dynamic-state>
                </xxf:dynamic-state>
                <xxf:action>
                    <xxf:control-values>
                        <xxf:control id="my-inplace-input" label="Label me!" hint="Hint hint!" readonly="true"/>
                        <xxf:control id="my-inplace-input≡xf-4" class="fr-component-group"/>
                        <xxf:div id="my-inplace-input≡fr-inplace-view" visibility="visible"/>
                        <xxf:div id="my-inplace-input≡fr-inplace-edit" visibility="hidden"/>
                        <xxf:control id="my-inplace-input≡xf-6" class="xforms-activable fr-inplace-hint" readonly="true">42</xxf:control>
                        <xxf:control id="my-inplace-input≡xf-11" class="fr-inplace-content fr-inplace-edit" relevant="false"/>
                        <xxf:control id="my-inplace-input≡input" relevant="false"/>
                        <xxf:control id="my-inplace-input≡apply" relevant="false"/>
                        <xxf:control id="my-inplace-input≡xf-13" relevant="false"/>
                    </xxf:control-values>
                </xxf:action>
            </xxf:event-response>
        </output>
    </test>

    <test description="fr:tabview id and XPath references" name="oxf:pipeline">
        <input name="config" href="wrap-xforms-state.xpl"/>
        <input name="document">
            <xh:html 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">
                <xh:head>
                    <xf:model id="model">
                        <xf:instance id="instance">
                            <instance>
                                <value>42</value>
                            </instance>
                        </xf:instance>

                        <!-- TEST: Events to gather -->
                        <xf:instance id="events">
                            <events/>
                        </xf:instance>

                        <!-- Dispatch initial event -->
                        <xf:dispatch ev:event="xforms-ready" targetid="group1" name="my-event"/>
                    </xf:model>
                    <xi:include href="oxf:/xbl/orbeon/tabview/tabview.xbl" xxi:omit-xml-base="true"/>
                </xh:head>
                <xh:body>
                    <xf:group id="group1">
                        <xf:action ev:event="my-event" ev:target="group1">
                            <!-- TEST: Event listener -->
                            <xf:insert context="instance('events')" ref="*"
                                           origin="xxf:element('event',
                                                    (xxf:attribute('type', event('xxf:type')),
                                                     xxf:attribute('target', event('xxf:targetid')),
                                                     xxf:attribute('indexes', string-join(event('xxf:repeat-indexes'), ' '))))"/>

                            <xf:dispatch targetid="group2" name="my-event"/>
                        </xf:action>
                    </xf:group>
                    <fr:tabview id="my-tabview">
                        <xf:setvalue ev:event="my-event" ev:target="group1" ref="event2">44</xf:setvalue>
                        <fr:tab id="tab1">
                            <fr:label/>
                            <xf:group id="group2">
                                <xf:action ev:event="my-event" ev:target="group2">
                                    <!-- TEST: Event listener -->
                                    <xf:insert context="instance('events')" ref="*"
                                                   origin="xxf:element('event',
                                                            (xxf:attribute('type', event('xxf:type')),
                                                             xxf:attribute('target', event('xxf:targetid')),
                                                             xxf:attribute('indexes', string-join(event('xxf:repeat-indexes'), ' '))))"/>

                                    <xf:dispatch targetid="group3" name="my-event"/>
                                </xf:action>
                                <xf:output id="output1" ref="instance('instance')/value"/>
                                <xf:output id="output2" ref="value"/>
                            </xf:group>
                        </fr:tab>
                        <fr:tab id="tab2">
                            <fr:label/>
                            <xf:group id="group3">
                                <xf:action ev:event="my-event" ev:target="group3">
                                    <!-- TEST: Event listener -->
                                    <xf:insert context="instance('events')" ref="*"
                                                   origin="xxf:element('event',
                                                            (xxf:attribute('type', event('xxf:type')),
                                                             xxf:attribute('target', event('xxf:targetid')),
                                                             xxf:attribute('indexes', string-join(event('xxf:repeat-indexes'), ' '))))"/>

                                    <xf:dispatch targetid="group4" name="my-event"/>
                                </xf:action>
                                <xf:output id="output3" ref="instance('instance')/value"/>
                                <xf:output id="output4" ref="value"/>
                            </xf:group>
                        </fr:tab>
                    </fr:tabview>
                    <xf:group id="group4">
                        <xf:action ev:event="my-event" ev:target="group4">
                            <!-- TEST: Event listener -->
                            <xf:insert context="instance('events')" ref="*"
                                           origin="xxf:element('event',
                                                    (xxf:attribute('type', event('xxf:type')),
                                                     xxf:attribute('target', event('xxf:targetid')),
                                                     xxf:attribute('indexes', string-join(event('xxf:repeat-indexes'), ' '))))"/>
                        </xf:action>
                    </xf:group>
                </xh:body>
            </xh:html>
        </input>
        <output name="response">
            <xxf:event-response xmlns:xxf="http://orbeon.org/oxf/xml/xforms">
                <xxf:dynamic-state>
                    <dynamic-state>
                        <instances>
                            <instance id="events" model-id="model">
                                <events>
                                    <event type="my-event" target="group1" indexes=""/>
                                    <event type="my-event" target="group2" indexes=""/>
                                    <event type="my-event" target="group3" indexes=""/>
                                    <event type="my-event" target="group4" indexes=""/>
                                </events>
                            </instance>
                            <instance id="tabview-instance" model-id="my-tabview≡tabview-model">
                                <tabview-instance>
                                    <active-tab-position>1</active-tab-position>
                                </tabview-instance>
                            </instance>
                        </instances>
                    </dynamic-state>
                </xxf:dynamic-state>
                <xxf:action>
                    <xxf:control-values>
                        <xxf:control class="selected" id="my-tabview≡nav-1"/>
                        <xxf:control id="my-tabview≡fr-tabview-content" class="yui-content"/>
                        <xxf:control id="my-tabview≡output1">42</xxf:control>
                        <xxf:control id="my-tabview≡output2">42</xxf:control>
                        <xxf:control id="my-tabview≡output3">42</xxf:control>
                        <xxf:control id="my-tabview≡output4">42</xxf:control>
                    </xxf:control-values>
                    <xxf:script name="xf_fa3c6018b6aca63d2389f350f65e272530d03568" target-id="my-tabview≡fr-tabview-group" observer-id="my-tabview≡fr-tabview-group"/>
                </xxf:action>
            </xxf:event-response>
        </output>
    </test>

    <test description="fr:tabview label resolution" name="oxf:pipeline">
        <input name="config" href="wrap-xforms-state.xpl"/>
        <input name="document">
            <xh:html 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">
                <xh:head>
                    <xf:model id="model">
                        <xf:instance id="instance">
                            <instance>
                                <label3>My label 3</label3>
                                <label4>My label 4</label4>
                                <label5>My label 5</label5>
                                <label6>My label 6</label6>
                            </instance>
                        </xf:instance>

                        <xf:bind id="label5-bind" ref="label5"/>
                    </xf:model>
                    <xf:model id="model2">
                        <xf:instance id="instance2">
                            <instance>
                                <label7>My label 7</label7>
                            </instance>
                        </xf:instance>
                    </xf:model>
                    <xi:include href="oxf:/xbl/orbeon/tabview/tabview.xbl" xxi:omit-xml-base="true"/>
                </xh:head>
                <xh:body>
                    <fr:tabview id="my-tabview">
                        <fr:tab id="tab1">
                            <fr:label/>
                        </fr:tab>
                        <fr:tab id="tab2">
                            <fr:label>My label 2</fr:label>
                        </fr:tab>
                        <fr:tab id="tab3">
                            <fr:label ref="label3"/>
                        </fr:tab>
                        <fr:tab id="tab4">
                            <fr:label value="label4"/>
                        </fr:tab>
                        <fr:tab id="tab5">
                            <fr:label bind="label5-bind"/>
                        </fr:tab>
                        <fr:tab id="tab6">
                            <fr:label context="label5" ref="../label6"/>
                        </fr:tab>
                        <fr:tab id="tab7">
                            <fr:label model="model2" ref="label7"/>
                        </fr:tab>
                    </fr:tabview>
                </xh:body>
            </xh:html>
        </input>
        <output name="response">
            <xxf:event-response xmlns:xxf="http://orbeon.org/oxf/xml/xforms">
                <xxf:dynamic-state>
                    <dynamic-state>
                        <instances>
                            <instance id="tabview-instance" model-id="my-tabview≡tabview-model">
                                <tabview-instance>
                                    <active-tab-position>1</active-tab-position>
                                </tabview-instance>
                            </instance>
                        </instances>
                    </dynamic-state>
                </xxf:dynamic-state>
                <xxf:action>
                    <xxf:control-values>
                        <xxf:control class="selected" id="my-tabview≡nav-1"/>
                        <xxf:control id="my-tabview≡xf-38">My label 3</xxf:control>
                        <xxf:control id="my-tabview≡xf-40">My label 4</xxf:control>
                        <xxf:control id="my-tabview≡xf-42">My label 5</xxf:control>
                        <xxf:control id="my-tabview≡xf-44">My label 6</xxf:control>
                        <xxf:control id="my-tabview≡xf-46">My label 7</xxf:control>
                        <xxf:control id="my-tabview≡fr-tabview-content" class="yui-content"/>
                    </xxf:control-values>
                    <xxf:script name="xf_fa3c6018b6aca63d2389f350f65e272530d03568" target-id="my-tabview≡fr-tabview-group" observer-id="my-tabview≡fr-tabview-group"/>
                </xxf:action>
            </xxf:event-response>
        </output>
    </test>

    <test description="fr:error-summary" name="oxf:pipeline">
        <input name="config" href="wrap-xforms-state.xpl"/>
        <input name="document">
            <xh:html 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">
                <xh:head>
                    <xf:model id="model">
                        <xf:instance id="instance">
                            <instance>
                                <first-name/>
                                <note/>
                                <note/>
                                <last-name/>
                            </instance>
                        </xf:instance>

                        <xf:bind id="first-name-bind" ref="first-name" required="true()"/>
                        <xf:bind id="last-name-bind" ref="last-name" required="true()"/>
                        <xf:bind id="note-bind" ref="note" required="true()"/>

                        <xf:instance id="error-summary-instance">
                            <error-summary>
                                <valid/>
                                <errors-count/>
                                <visible-errors-count/>
                            </error-summary>
                        </xf:instance>

                        <xf:action ev:event="xforms-ready">
                            <!-- Visit last-name -->
                            <xf:dispatch name="DOMFocusOut" targetid="last-name-control"/>
                            <!-- Visit note #2 -->
                            <xf:setindex repeat="repeat" index="2"/>
                            <xf:dispatch name="DOMFocusOut" targetid="note-control"/>
                            <!-- Insert new note #2 -->
                            <xf:insert ref="note" at="1" position="after" origin="xxf:element('note')"/>
                        </xf:action>

                    </xf:model>
                    <xi:include href="oxf:/xbl/orbeon/error-summary/error-summary.xbl" xxi:omit-xml-base="true"/>
                </xh:head>
                <xh:body>
                    <fr:error-summary id="my-summary" observer="my-group"
                                      context="instance('error-summary-instance')"
                                      errors-count-ref="errors-count"
                                      visible-errors-count-ref="visible-errors-count"
                                      valid-ref="valid"/>

                    <xf:group id="my-group">
                        <xf:input id="first-name-control" ref="first-name">
                            <xf:label>First name</xf:label>
                            <xf:alert>Invalid first name</xf:alert>
                        </xf:input>
                        <xf:repeat ref="note" id="repeat">
                            <xf:input id="note-control" ref=".">
                                <xf:label>Note</xf:label>
                                <xf:alert>Invalid note</xf:alert>
                            </xf:input>
                        </xf:repeat>
                        <xf:input id="last-name-control" ref="last-name">
                            <xf:label>Last name</xf:label>
                            <xf:alert>Invalid last name</xf:alert>
                        </xf:input>
                    </xf:group>
                </xh:body>
            </xh:html>
        </input>
        <output name="response">
            <xxf:event-response>
                <xxf:dynamic-state>
                    <dynamic-state>
                        <instances>
                            <instance id="instance" model-id="model">
                                <instance>
                                    <first-name/>
                                    <note/>
                                    <note/>
                                    <note/>
                                    <last-name/>
                                </instance>
                            </instance>
                            <instance id="error-summary-instance" model-id="model">
                                <error-summary>
                                    <valid>false</valid>
                                    <errors-count>5</errors-count>
                                    <visible-errors-count>2</visible-errors-count>
                                </error-summary>
                            </instance>
                            <instance id="fr-errors-instance" model-id="my-summary≡fr-error-summary-model">
                                <errors>
                                    <error absolute-id="|first-name-control|" position="152" label="First name" alert="Invalid first name" level="error" section-name=""/>
                                    <error absolute-id="|note-control⊙1|" position="157" label="Note" alert="Invalid note" level="error" section-name=""/>
                                    <error absolute-id="|note-control⊙2|" position="157" label="Note" alert="Invalid note" level="error" section-name=""/>
                                    <error absolute-id="|note-control⊙3|" position="157" label="Note" alert="Invalid note" level="error" section-name=""/>
                                    <error absolute-id="|last-name-control|" position="160" label="Last name" alert="Invalid last name" level="error" section-name=""/>
                                </errors>
                            </instance>
                            <instance id="fr-state-instance" model-id="my-summary≡fr-error-summary-model">
                                <state>
                                    <!-- Whether errors are shown incrementally or not -->
                                    <incremental/>
                                    <!-- Absolute ids of observers -->
                                    <observers>my-group</observers>
                                    <!-- Whether the form is valid or invalid -->
                                    <valid>false</valid>
                                    <!-- Number of alerts, total vs. per level -->
                                    <counts alert="5" error="5" warning="0" info="0"/>
                                    <visible-counts alert="2" error="2" warning="0" info="0"/>
                                </state>
                            </instance>
                        </instances>
                        <controls>
                            <control effective-id="my-summary≡er" index="2"/>
                            <control effective-id="my-summary≡xf-116⊙1" case-id="xf-121"/>
                            <control effective-id="my-summary≡xf-122⊙1" case-id="xf-123"/>
                            <control effective-id="my-summary≡xf-116⊙2" case-id="xf-121"/>
                            <control effective-id="my-summary≡xf-122⊙2" case-id="xf-123"/>
                            <control effective-id="repeat" index="2"/>
                        </controls>
                    </dynamic-state>
                </xxf:dynamic-state>
                <xxf:action>
                    <xxf:control-values>
                        <xxf:control id="my-summary≡body" class="fr-error-summary-body fr-level-error"/>
                        <xxf:control id="my-summary≡xf-115⊙1">1</xxf:control>
                        <xxf:div id="my-summary≡xf-121⊙1" visibility="visible"/>
                        <xxf:div id="my-summary≡xf-117⊙1" visibility="hidden"/>
                        <xxf:attribute for="my-summary≡xf-118⊙1" name="href"/>
                        <xxf:control id="my-summary≡xf-120⊙1" class="fr-error-label" relevant="false"/>
                        <xxf:div id="my-summary≡xf-123⊙1" visibility="visible"/>
                        <xxf:div id="my-summary≡xf-127⊙1" visibility="hidden"/>
                        <xxf:control id="my-summary≡xf-124⊙1" class="fr-error-label" label="Note"/>
                        <xxf:control id="my-summary≡xf-128⊙1" class="fr-error-label" relevant="false"/>
                        <xxf:control id="my-summary≡ao⊙1" class="fr-error-alert fr-error-alert-error">Invalid note</xxf:control>
                        <xxf:control id="my-summary≡xf-115⊙2">2</xxf:control>
                        <xxf:div id="my-summary≡xf-121⊙2" visibility="visible"/>
                        <xxf:div id="my-summary≡xf-117⊙2" visibility="hidden"/>
                        <xxf:attribute for="my-summary≡xf-118⊙2" name="href"/>
                        <xxf:control id="my-summary≡xf-120⊙2" class="fr-error-label" relevant="false"/>
                        <xxf:div id="my-summary≡xf-123⊙2" visibility="visible"/>
                        <xxf:div id="my-summary≡xf-127⊙2" visibility="hidden"/>
                        <xxf:control id="my-summary≡xf-124⊙2" class="fr-error-label" label="Last name"/>
                        <xxf:control id="my-summary≡xf-128⊙2" class="fr-error-label" relevant="false"/>
                        <xxf:control id="my-summary≡ao⊙2" class="fr-error-alert fr-error-alert-error">Invalid last name</xxf:control>
                        <xxf:control id="first-name-control" label="First name" alert="Invalid first name" required="true" level="error" empty="true"/>
                        <xxf:control id="note-control⊙1" label="Note" alert="Invalid note" required="true" level="error" empty="true"/>
                        <xxf:control id="note-control⊙2" label="Note" alert="Invalid note" required="true" level="error" empty="true"/>
                        <xxf:control id="note-control⊙3" label="Note" alert="Invalid note" visited="true" required="true" level="error" empty="true"/>
                        <xxf:control id="last-name-control" label="Last name" alert="Invalid last name" visited="true" required="true" level="error" empty="true"/>
                    </xxf:control-values>
                </xxf:action>
            </xxf:event-response>
        </output>
    </test>

    <test description="xf:setfocus on fr:date" name="oxf:pipeline">
        <input name="config" href="wrap-xforms-state.xpl"/>
        <input name="document">
            <xh:html xmlns:xxf="http://orbeon.org/oxf/xml/xforms" xmlns:fr="http://orbeon.org/oxf/xml/form-runner">
                <xh:head>
                    <xf:model id="model">
                        <xf:instance id="instance">
                            <instance xmlns="">
                                <date>2010-01-13</date>
                            </instance>
                        </xf:instance>

                        <xf:action ev:event="xforms-ready">
                            <xf:setfocus control="my-date"/>
                        </xf:action>

                    </xf:model>
                    <xi:include href="oxf:/xbl/orbeon/date/date.xbl" xxi:omit-xml-base="true"/>
                </xh:head>
                <xh:body>
                    <fr:date id="my-date" ref="date"/>
                </xh:body>
            </xh:html>
        </input>
        <output name="response">
            <xxf:event-response xmlns:xxf="http://orbeon.org/oxf/xml/xforms">
                <xxf:dynamic-state>
                    <dynamic-state/>
                </xxf:dynamic-state>
                <xxf:action>
                    <xxf:control-values>
                        <xxf:control id="my-date≡xf-6">2010-01-13</xxf:control>
                        <xxf:control id="my-date≡xf-9" class="xbl-fr-date-mindate"/>
                        <xxf:attribute for="my-date≡xf-9" name="style">display: none</xxf:attribute>
                        <xxf:control id="my-date≡xf-12" class="xbl-fr-date-maxdate"/>
                        <xxf:attribute for="my-date≡xf-12" name="style">display: none</xxf:attribute>
                        <xxf:control id="my-date≡xf-15" class="xbl-fr-date-pagedate"/>
                        <xxf:attribute for="my-date≡xf-15" name="style">display: none</xxf:attribute>
                    </xxf:control-values>
                    <xxf:focus control-id="my-date≡xf-6"/>
                </xxf:action>
            </xxf:event-response>
        </output>
    </test>

    <test description="xf:setfocus on fr:currency" name="oxf:pipeline">
        <input name="config" href="wrap-xforms-state.xpl"/>
        <input name="document">
            <xh:html xmlns:xxf="http://orbeon.org/oxf/xml/xforms" xmlns:fr="http://orbeon.org/oxf/xml/form-runner">
                <xh:head>
                    <xf:model id="model">
                        <xf:instance id="instance">
                            <instance xmlns="">
                                <currency>12.34</currency>
                            </instance>
                        </xf:instance>

                        <xf:action ev:event="xforms-ready">
                            <xf:setfocus control="my-currency"/>
                        </xf:action>

                    </xf:model>
                    <xi:include href="oxf:/xbl/orbeon/currency/currency.xbl" xxi:omit-xml-base="true"/>
                </xh:head>
                <xh:body>
                    <fr:currency id="my-currency" ref="currency"/>
                </xh:body>
            </xh:html>
        </input>
        <output name="response">
            <xxf:event-response>
                <xxf:dynamic-state>
                    <dynamic-state/>
                </xxf:dynamic-state>
                <xxf:action>
                    <xxf:control-values>
                        <xxf:control id="my-currency≡xf-9" class="xbl-fr-currency-prefix">$</xxf:control>
                        <xxf:attribute for="my-currency≡xf-9" name="style">display: none</xxf:attribute>
                        <xxf:control id="my-currency≡xf-12" class="xbl-fr-currency-suffix"/>
                        <xxf:attribute for="my-currency≡xf-12" name="style">display: none</xxf:attribute>
                        <xxf:control id="my-currency≡xf-15" class="xbl-fr-currency-decimal-separator">.</xxf:control>
                        <xxf:attribute for="my-currency≡xf-15" name="style">display: none</xxf:attribute>
                        <xxf:control id="my-currency≡xf-18" class="xbl-fr-currency-grouping-separator">,</xxf:control>
                        <xxf:attribute for="my-currency≡xf-18" name="style">display: none</xxf:attribute>
                        <xxf:control id="my-currency≡xf-21" class="xbl-fr-currency-digits-after-decimal">2</xxf:control>
                        <xxf:attribute for="my-currency≡xf-21" name="style">display: none</xxf:attribute>
                        <xxf:control id="my-currency≡xf-29" class="xbl-fr-number-xforms-input xforms-hidden">12.34</xxf:control>
                        <xxf:control class="fr-width-10em input-prepend" id="my-currency≡xf-30"/>
                        <xxf:control id="my-currency≡xf-32" class="add-on"/>
                        <xxf:control id="my-currency≡xf-33">$</xxf:control>
                        <xxf:control id="my-currency≡xf-34" class="add-on" relevant="false"/>
                        <xxf:control id="my-currency≡xf-35" relevant="false"/>
                        <xxf:control id="my-currency≡xf-36" relevant="false"/>
                    </xxf:control-values>
                    <xxf:script name="xf_01d33a0f45056a1c82a2217322761ac96dcf3673" target-id="my-currency≡formatted-value" observer-id="my-currency≡xf-5"/>
                    <xxf:script name="xf_3d8d3c03734d8364587001d7d7575079cede66dd" target-id="my-currency" observer-id="my-currency"/>
                    <xxf:focus control-id="my-currency"/>
                </xxf:action>
            </xxf:event-response>
        </output>
    </test>

    <test description="xf:setfocus on fr:autocomplete" name="oxf:pipeline">
        <input name="config" href="wrap-xforms-state.xpl"/>
        <input name="document">
            <xh:html xmlns:xxf="http://orbeon.org/oxf/xml/xforms" xmlns:fr="http://orbeon.org/oxf/xml/form-runner">
                <xh:head>
                    <xf:model id="model">
                        <xf:instance id="instance">
                            <instance xmlns="">
                                <value>One</value>
                                <item>One</item>
                                <item>Two</item>
                                <item>Three</item><commit_msg>For #1864: fix test following 307eab2a2e3cf776b89f666de4ae5ff1f27d0b8e<commit_after><!--
  Copyright (C) 2010 Orbeon, Inc.

  This program is free software; you can redistribute it and/or modify it under the terms of the
  GNU Lesser General Public License as published by the Free Software Foundation; either version
  2.1 of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the GNU Lesser General Public License for more details.

  The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
  -->
<group description="XForms XBL Components" xmlns:p="http://www.orbeon.com/oxf/pipeline"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xh="http://www.w3.org/1999/xhtml"
    xmlns:oxf="http://www.orbeon.com/oxf/processors"
    xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
    xmlns:xf="http://www.w3.org/2002/xforms"
    xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
    xmlns:xbl="http://www.w3.org/ns/xbl"
    xmlns:fr="http://orbeon.org/oxf/xml/form-runner">

    <test description="fr:inplace-input's hint evaluates in outer context" name="oxf:pipeline">
        <input name="config" href="wrap-xforms-state.xpl"/>
        <input name="document">
            <xh:html 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">
                <xh:head>
                    <xf:model id="model">
                        <xf:instance id="instance">
                            <instance>
                                <value/>
                                <label>Label me!</label>
                                <hint>Hint hint!</hint>
                            </instance>
                        </xf:instance>
                    </xf:model>
                    <xi:include href="oxf:/xbl/orbeon/inplace-input/inplace-input.xbl" xxi:omit-xml-base="true"/>
                </xh:head>
                <xh:body>
                    <xf:var name="my-hint" value="hint"/>
                    <fr:inplace-input id="my-inplace-input" ref="value">
                        <xf:label ref="../label"/>
                        <xf:hint ref="$my-hint"/>
                    </fr:inplace-input>
                </xh:body>
            </xh:html>
        </input>
        <output name="response">
            <xxf:event-response xmlns:xxf="http://orbeon.org/oxf/xml/xforms">
                <xxf:dynamic-state>
                    <dynamic-state>
                        <controls>
                            <control effective-id="my-inplace-input≡xf-4" case-id="fr-inplace-view"/>
                        </controls>
                    </dynamic-state>
                </xxf:dynamic-state>
                <xxf:action>
                    <xxf:control-values>
                        <xxf:control id="my-inplace-input" label="Label me!" hint="Hint hint!"/>
                        <xxf:control id="my-inplace-input≡xf-4" class="fr-component-group"/>
                        <xxf:div id="my-inplace-input≡fr-inplace-view" visibility="visible"/>
                        <xxf:div id="my-inplace-input≡fr-inplace-edit" visibility="hidden"/>
                        <xxf:control id="my-inplace-input≡xf-6" class="xforms-activable fr-inplace-hint">Hint hint!</xxf:control>
                        <xxf:control id="my-inplace-input≡xf-11" class="fr-inplace-content fr-inplace-edit"/>
                        <xxf:control id="my-inplace-input≡apply" label="Apply"/>
                        <xxf:control id="my-inplace-input≡xf-13" label="Cancel"/>
                    </xxf:control-values>
                </xxf:action>
            </xxf:event-response>
        </output>
    </test>

    <test description="fr:inplace-input pointing to readonly node" name="oxf:pipeline">
        <input name="config" href="wrap-xforms-state.xpl"/>
        <input name="document">
            <xh:html 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">
                <xh:head>
                    <xf:model id="model">
                        <xf:instance id="instance">
                            <instance>
                                <value>42</value>
                            </instance>
                        </xf:instance>
                        <xf:bind ref="value" readonly="true()"/>
                    </xf:model>
                    <xi:include href="oxf:/xbl/orbeon/inplace-input/inplace-input.xbl" xxi:omit-xml-base="true"/>
                </xh:head>
                <xh:body>
                    <fr:inplace-input id="my-inplace-input" ref="value">
                        <xf:label>Label me!</xf:label>
                        <xf:hint>Hint hint!</xf:hint>
                    </fr:inplace-input>
                </xh:body>
            </xh:html>
        </input>
        <output name="response">
            <xxf:event-response xmlns:xxf="http://orbeon.org/oxf/xml/xforms">
                <xxf:dynamic-state>
                    <dynamic-state>
                        <controls>
                            <control effective-id="my-inplace-input≡xf-4" case-id="fr-inplace-view"/>
                        </controls>
                    </dynamic-state>
                </xxf:dynamic-state>
                <xxf:action>
                    <xxf:control-values>
                        <xxf:control id="my-inplace-input" label="Label me!" hint="Hint hint!" readonly="true"/>
                        <xxf:control id="my-inplace-input≡xf-4" class="fr-component-group"/>
                        <xxf:div id="my-inplace-input≡fr-inplace-view" visibility="visible"/>
                        <xxf:div id="my-inplace-input≡fr-inplace-edit" visibility="hidden"/>
                        <xxf:control id="my-inplace-input≡xf-6" class="xforms-activable fr-inplace-hint" readonly="true">42</xxf:control>
                        <xxf:control id="my-inplace-input≡xf-11" class="fr-inplace-content fr-inplace-edit" relevant="false"/>
                        <xxf:control id="my-inplace-input≡input" relevant="false"/>
                        <xxf:control id="my-inplace-input≡apply" relevant="false"/>
                        <xxf:control id="my-inplace-input≡xf-13" relevant="false"/>
                    </xxf:control-values>
                </xxf:action>
            </xxf:event-response>
        </output>
    </test>

    <test description="fr:tabview id and XPath references" name="oxf:pipeline">
        <input name="config" href="wrap-xforms-state.xpl"/>
        <input name="document">
            <xh:html 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">
                <xh:head>
                    <xf:model id="model">
                        <xf:instance id="instance">
                            <instance>
                                <value>42</value>
                            </instance>
                        </xf:instance>

                        <!-- TEST: Events to gather -->
                        <xf:instance id="events">
                            <events/>
                        </xf:instance>

                        <!-- Dispatch initial event -->
                        <xf:dispatch ev:event="xforms-ready" targetid="group1" name="my-event"/>
                    </xf:model>
                    <xi:include href="oxf:/xbl/orbeon/tabview/tabview.xbl" xxi:omit-xml-base="true"/>
                </xh:head>
                <xh:body>
                    <xf:group id="group1">
                        <xf:action ev:event="my-event" ev:target="group1">
                            <!-- TEST: Event listener -->
                            <xf:insert context="instance('events')" ref="*"
                                           origin="xxf:element('event',
                                                    (xxf:attribute('type', event('xxf:type')),
                                                     xxf:attribute('target', event('xxf:targetid')),
                                                     xxf:attribute('indexes', string-join(event('xxf:repeat-indexes'), ' '))))"/>

                            <xf:dispatch targetid="group2" name="my-event"/>
                        </xf:action>
                    </xf:group>
                    <fr:tabview id="my-tabview">
                        <xf:setvalue ev:event="my-event" ev:target="group1" ref="event2">44</xf:setvalue>
                        <fr:tab id="tab1">
                            <fr:label/>
                            <xf:group id="group2">
                                <xf:action ev:event="my-event" ev:target="group2">
                                    <!-- TEST: Event listener -->
                                    <xf:insert context="instance('events')" ref="*"
                                                   origin="xxf:element('event',
                                                            (xxf:attribute('type', event('xxf:type')),
                                                             xxf:attribute('target', event('xxf:targetid')),
                                                             xxf:attribute('indexes', string-join(event('xxf:repeat-indexes'), ' '))))"/>

                                    <xf:dispatch targetid="group3" name="my-event"/>
                                </xf:action>
                                <xf:output id="output1" ref="instance('instance')/value"/>
                                <xf:output id="output2" ref="value"/>
                            </xf:group>
                        </fr:tab>
                        <fr:tab id="tab2">
                            <fr:label/>
                            <xf:group id="group3">
                                <xf:action ev:event="my-event" ev:target="group3">
                                    <!-- TEST: Event listener -->
                                    <xf:insert context="instance('events')" ref="*"
                                                   origin="xxf:element('event',
                                                            (xxf:attribute('type', event('xxf:type')),
                                                             xxf:attribute('target', event('xxf:targetid')),
                                                             xxf:attribute('indexes', string-join(event('xxf:repeat-indexes'), ' '))))"/>

                                    <xf:dispatch targetid="group4" name="my-event"/>
                                </xf:action>
                                <xf:output id="output3" ref="instance('instance')/value"/>
                                <xf:output id="output4" ref="value"/>
                            </xf:group>
                        </fr:tab>
                    </fr:tabview>
                    <xf:group id="group4">
                        <xf:action ev:event="my-event" ev:target="group4">
                            <!-- TEST: Event listener -->
                            <xf:insert context="instance('events')" ref="*"
                                           origin="xxf:element('event',
                                                    (xxf:attribute('type', event('xxf:type')),
                                                     xxf:attribute('target', event('xxf:targetid')),
                                                     xxf:attribute('indexes', string-join(event('xxf:repeat-indexes'), ' '))))"/>
                        </xf:action>
                    </xf:group>
                </xh:body>
            </xh:html>
        </input>
        <output name="response">
            <xxf:event-response xmlns:xxf="http://orbeon.org/oxf/xml/xforms">
                <xxf:dynamic-state>
                    <dynamic-state>
                        <instances>
                            <instance id="events" model-id="model">
                                <events>
                                    <event type="my-event" target="group1" indexes=""/>
                                    <event type="my-event" target="group2" indexes=""/>
                                    <event type="my-event" target="group3" indexes=""/>
                                    <event type="my-event" target="group4" indexes=""/>
                                </events>
                            </instance>
                            <instance id="tabview-instance" model-id="my-tabview≡tabview-model">
                                <tabview-instance>
                                    <active-tab-position>1</active-tab-position>
                                </tabview-instance>
                            </instance>
                        </instances>
                    </dynamic-state>
                </xxf:dynamic-state>
                <xxf:action>
                    <xxf:control-values>
                        <xxf:control class="selected" id="my-tabview≡nav-1"/>
                        <xxf:control id="my-tabview≡fr-tabview-content" class="yui-content"/>
                        <xxf:control id="my-tabview≡output1">42</xxf:control>
                        <xxf:control id="my-tabview≡output2">42</xxf:control>
                        <xxf:control id="my-tabview≡output3">42</xxf:control>
                        <xxf:control id="my-tabview≡output4">42</xxf:control>
                    </xxf:control-values>
                    <xxf:script name="xf_fa3c6018b6aca63d2389f350f65e272530d03568" target-id="my-tabview≡fr-tabview-group" observer-id="my-tabview≡fr-tabview-group"/>
                </xxf:action>
            </xxf:event-response>
        </output>
    </test>

    <test description="fr:tabview label resolution" name="oxf:pipeline">
        <input name="config" href="wrap-xforms-state.xpl"/>
        <input name="document">
            <xh:html 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">
                <xh:head>
                    <xf:model id="model">
                        <xf:instance id="instance">
                            <instance>
                                <label3>My label 3</label3>
                                <label4>My label 4</label4>
                                <label5>My label 5</label5>
                                <label6>My label 6</label6>
                            </instance>
                        </xf:instance>

                        <xf:bind id="label5-bind" ref="label5"/>
                    </xf:model>
                    <xf:model id="model2">
                        <xf:instance id="instance2">
                            <instance>
                                <label7>My label 7</label7>
                            </instance>
                        </xf:instance>
                    </xf:model>
                    <xi:include href="oxf:/xbl/orbeon/tabview/tabview.xbl" xxi:omit-xml-base="true"/>
                </xh:head>
                <xh:body>
                    <fr:tabview id="my-tabview">
                        <fr:tab id="tab1">
                            <fr:label/>
                        </fr:tab>
                        <fr:tab id="tab2">
                            <fr:label>My label 2</fr:label>
                        </fr:tab>
                        <fr:tab id="tab3">
                            <fr:label ref="label3"/>
                        </fr:tab>
                        <fr:tab id="tab4">
                            <fr:label value="label4"/>
                        </fr:tab>
                        <fr:tab id="tab5">
                            <fr:label bind="label5-bind"/>
                        </fr:tab>
                        <fr:tab id="tab6">
                            <fr:label context="label5" ref="../label6"/>
                        </fr:tab>
                        <fr:tab id="tab7">
                            <fr:label model="model2" ref="label7"/>
                        </fr:tab>
                    </fr:tabview>
                </xh:body>
            </xh:html>
        </input>
        <output name="response">
            <xxf:event-response xmlns:xxf="http://orbeon.org/oxf/xml/xforms">
                <xxf:dynamic-state>
                    <dynamic-state>
                        <instances>
                            <instance id="tabview-instance" model-id="my-tabview≡tabview-model">
                                <tabview-instance>
                                    <active-tab-position>1</active-tab-position>
                                </tabview-instance>
                            </instance>
                        </instances>
                    </dynamic-state>
                </xxf:dynamic-state>
                <xxf:action>
                    <xxf:control-values>
                        <xxf:control class="selected" id="my-tabview≡nav-1"/>
                        <xxf:control id="my-tabview≡xf-38">My label 3</xxf:control>
                        <xxf:control id="my-tabview≡xf-40">My label 4</xxf:control>
                        <xxf:control id="my-tabview≡xf-42">My label 5</xxf:control>
                        <xxf:control id="my-tabview≡xf-44">My label 6</xxf:control>
                        <xxf:control id="my-tabview≡xf-46">My label 7</xxf:control>
                        <xxf:control id="my-tabview≡fr-tabview-content" class="yui-content"/>
                    </xxf:control-values>
                    <xxf:script name="xf_fa3c6018b6aca63d2389f350f65e272530d03568" target-id="my-tabview≡fr-tabview-group" observer-id="my-tabview≡fr-tabview-group"/>
                </xxf:action>
            </xxf:event-response>
        </output>
    </test>

    <test description="fr:error-summary" name="oxf:pipeline">
        <input name="config" href="wrap-xforms-state.xpl"/>
        <input name="document">
            <xh:html 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">
                <xh:head>
                    <xf:model id="model">
                        <xf:instance id="instance">
                            <instance>
                                <first-name/>
                                <note/>
                                <note/>
                                <last-name/>
                            </instance>
                        </xf:instance>

                        <xf:bind id="first-name-bind" ref="first-name" required="true()"/>
                        <xf:bind id="last-name-bind" ref="last-name" required="true()"/>
                        <xf:bind id="note-bind" ref="note" required="true()"/>

                        <xf:instance id="error-summary-instance">
                            <error-summary>
                                <valid/>
                                <errors-count/>
                                <visible-errors-count/>
                            </error-summary>
                        </xf:instance>

                        <xf:action ev:event="xforms-ready">
                            <!-- Visit last-name -->
                            <xf:dispatch name="DOMFocusOut" targetid="last-name-control"/>
                            <!-- Visit note #2 -->
                            <xf:setindex repeat="repeat" index="2"/>
                            <xf:dispatch name="DOMFocusOut" targetid="note-control"/>
                            <!-- Insert new note #2 -->
                            <xf:insert ref="note" at="1" position="after" origin="xxf:element('note')"/>
                        </xf:action>

                    </xf:model>
                    <xi:include href="oxf:/xbl/orbeon/error-summary/error-summary.xbl" xxi:omit-xml-base="true"/>
                </xh:head>
                <xh:body>
                    <fr:error-summary id="my-summary" observer="my-group"
                                      context="instance('error-summary-instance')"
                                      errors-count-ref="errors-count"
                                      visible-errors-count-ref="visible-errors-count"
                                      valid-ref="valid"/>

                    <xf:group id="my-group">
                        <xf:input id="first-name-control" ref="first-name">
                            <xf:label>First name</xf:label>
                            <xf:alert>Invalid first name</xf:alert>
                        </xf:input>
                        <xf:repeat ref="note" id="repeat">
                            <xf:input id="note-control" ref=".">
                                <xf:label>Note</xf:label>
                                <xf:alert>Invalid note</xf:alert>
                            </xf:input>
                        </xf:repeat>
                        <xf:input id="last-name-control" ref="last-name">
                            <xf:label>Last name</xf:label>
                            <xf:alert>Invalid last name</xf:alert>
                        </xf:input>
                    </xf:group>
                </xh:body>
            </xh:html>
        </input>
        <output name="response">
            <xxf:event-response>
                <xxf:dynamic-state>
                    <dynamic-state>
                        <instances>
                            <instance id="instance" model-id="model">
                                <instance>
                                    <first-name/>
                                    <note/>
                                    <note/>
                                    <note/>
                                    <last-name/>
                                </instance>
                            </instance>
                            <instance id="error-summary-instance" model-id="model">
                                <error-summary>
                                    <valid>false</valid>
                                    <errors-count>5</errors-count>
                                    <visible-errors-count>2</visible-errors-count>
                                </error-summary>
                            </instance>
                            <instance id="fr-errors-instance" model-id="my-summary≡fr-error-summary-model">
                                <errors>
                                    <error absolute-id="|first-name-control|" position="152" label="First name" alert="Invalid first name" level="error" section-name=""/>
                                    <error absolute-id="|note-control⊙1|" position="157" label="Note" alert="Invalid note" level="error" section-name=""/>
                                    <error absolute-id="|note-control⊙2|" position="157" label="Note" alert="Invalid note" level="error" section-name=""/>
                                    <error absolute-id="|note-control⊙3|" position="157" label="Note" alert="Invalid note" level="error" section-name=""/>
                                    <error absolute-id="|last-name-control|" position="160" label="Last name" alert="Invalid last name" level="error" section-name=""/>
                                </errors>
                            </instance>
                            <instance id="fr-state-instance" model-id="my-summary≡fr-error-summary-model">
                                <state>
                                    <!-- Whether errors are shown incrementally or not -->
                                    <incremental/>
                                    <!-- Absolute ids of observers -->
                                    <observers>my-group</observers>
                                    <!-- Whether the form is valid or invalid -->
                                    <valid>false</valid>
                                    <!-- Number of alerts, total vs. per level -->
                                    <counts alert="5" error="5" warning="0" info="0"/>
                                    <visible-counts alert="2" error="2" warning="0" info="0"/>
                                </state>
                            </instance>
                        </instances>
                        <controls>
                            <control effective-id="my-summary≡er" index="2"/>
                            <control effective-id="my-summary≡xf-116⊙1" case-id="xf-121"/>
                            <control effective-id="my-summary≡xf-122⊙1" case-id="xf-123"/>
                            <control effective-id="my-summary≡xf-116⊙2" case-id="xf-121"/>
                            <control effective-id="my-summary≡xf-122⊙2" case-id="xf-123"/>
                            <control effective-id="repeat" index="2"/>
                        </controls>
                    </dynamic-state>
                </xxf:dynamic-state>
                <xxf:action>
                    <xxf:control-values>
                        <xxf:control id="my-summary≡body" class="fr-error-summary-body fr-level-error"/>
                        <xxf:control id="my-summary≡xf-115⊙1">1</xxf:control>
                        <xxf:div id="my-summary≡xf-121⊙1" visibility="visible"/>
                        <xxf:div id="my-summary≡xf-117⊙1" visibility="hidden"/>
                        <xxf:attribute for="my-summary≡xf-118⊙1" name="href"/>
                        <xxf:control id="my-summary≡xf-120⊙1" class="fr-error-label" relevant="false"/>
                        <xxf:div id="my-summary≡xf-123⊙1" visibility="visible"/>
                        <xxf:div id="my-summary≡xf-127⊙1" visibility="hidden"/>
                        <xxf:control id="my-summary≡xf-124⊙1" class="fr-error-label" label="Note"/>
                        <xxf:control id="my-summary≡xf-128⊙1" class="fr-error-label" relevant="false"/>
                        <xxf:control id="my-summary≡ao⊙1" class="fr-error-alert fr-error-alert-error">Invalid note</xxf:control>
                        <xxf:control id="my-summary≡xf-115⊙2">2</xxf:control>
                        <xxf:div id="my-summary≡xf-121⊙2" visibility="visible"/>
                        <xxf:div id="my-summary≡xf-117⊙2" visibility="hidden"/>
                        <xxf:attribute for="my-summary≡xf-118⊙2" name="href"/>
                        <xxf:control id="my-summary≡xf-120⊙2" class="fr-error-label" relevant="false"/>
                        <xxf:div id="my-summary≡xf-123⊙2" visibility="visible"/>
                        <xxf:div id="my-summary≡xf-127⊙2" visibility="hidden"/>
                        <xxf:control id="my-summary≡xf-124⊙2" class="fr-error-label" label="Last name"/>
                        <xxf:control id="my-summary≡xf-128⊙2" class="fr-error-label" relevant="false"/>
                        <xxf:control id="my-summary≡ao⊙2" class="fr-error-alert fr-error-alert-error">Invalid last name</xxf:control>
                        <xxf:control id="first-name-control" label="First name" alert="Invalid first name" required="true" level="error" empty="true"/>
                        <xxf:control id="note-control⊙1" label="Note" alert="Invalid note" required="true" level="error" empty="true"/>
                        <xxf:control id="note-control⊙2" label="Note" alert="Invalid note" required="true" level="error" empty="true"/>
                        <xxf:control id="note-control⊙3" label="Note" alert="Invalid note" visited="true" required="true" level="error" empty="true"/>
                        <xxf:control id="last-name-control" label="Last name" alert="Invalid last name" visited="true" required="true" level="error" empty="true"/>
                    </xxf:control-values>
                </xxf:action>
            </xxf:event-response>
        </output>
    </test>

    <test description="xf:setfocus on fr:date" name="oxf:pipeline">
        <input name="config" href="wrap-xforms-state.xpl"/>
        <input name="document">
            <xh:html xmlns:xxf="http://orbeon.org/oxf/xml/xforms" xmlns:fr="http://orbeon.org/oxf/xml/form-runner">
                <xh:head>
                    <xf:model id="model">
                        <xf:instance id="instance">
                            <instance xmlns="">
                                <date>2010-01-13</date>
                            </instance>
                        </xf:instance>

                        <xf:action ev:event="xforms-ready">
                            <xf:setfocus control="my-date"/>
                        </xf:action>

                    </xf:model>
                    <xi:include href="oxf:/xbl/orbeon/date/date.xbl" xxi:omit-xml-base="true"/>
                </xh:head>
                <xh:body>
                    <fr:date id="my-date" ref="date"/>
                </xh:body>
            </xh:html>
        </input>
        <output name="response">
            <xxf:event-response xmlns:xxf="http://orbeon.org/oxf/xml/xforms">
                <xxf:dynamic-state>
                    <dynamic-state/>
                </xxf:dynamic-state>
                <xxf:action>
                    <xxf:control-values>
                        <xxf:control id="my-date≡xf-6">2010-01-13</xxf:control>
                        <xxf:control id="my-date≡xf-9" class="xbl-fr-date-mindate"/>
                        <xxf:attribute for="my-date≡xf-9" name="style">display: none</xxf:attribute>
                        <xxf:control id="my-date≡xf-12" class="xbl-fr-date-maxdate"/>
                        <xxf:attribute for="my-date≡xf-12" name="style">display: none</xxf:attribute>
                        <xxf:control id="my-date≡xf-15" class="xbl-fr-date-pagedate"/>
                        <xxf:attribute for="my-date≡xf-15" name="style">display: none</xxf:attribute>
                    </xxf:control-values>
                    <xxf:focus control-id="my-date≡xf-6"/>
                </xxf:action>
            </xxf:event-response>
        </output>
    </test>

    <test description="xf:setfocus on fr:currency" name="oxf:pipeline">
        <input name="config" href="wrap-xforms-state.xpl"/>
        <input name="document">
            <xh:html xmlns:xxf="http://orbeon.org/oxf/xml/xforms" xmlns:fr="http://orbeon.org/oxf/xml/form-runner">
                <xh:head>
                    <xf:model id="model">
                        <xf:instance id="instance">
                            <instance xmlns="">
                                <currency>12.34</currency>
                            </instance>
                        </xf:instance>

                        <xf:action ev:event="xforms-ready">
                            <xf:setfocus control="my-currency"/>
                        </xf:action>

                    </xf:model>
                    <xi:include href="oxf:/xbl/orbeon/currency/currency.xbl" xxi:omit-xml-base="true"/>
                </xh:head>
                <xh:body>
                    <fr:currency id="my-currency" ref="currency"/>
                </xh:body>
            </xh:html>
        </input>
        <output name="response">
            <xxf:event-response>
                <xxf:dynamic-state>
                    <dynamic-state/>
                </xxf:dynamic-state>
                <xxf:action>
                    <xxf:control-values>
                        <xxf:control id="my-currency≡xf-9" class="xbl-fr-currency-prefix">$</xxf:control>
                        <xxf:attribute for="my-currency≡xf-9" name="style">display: none</xxf:attribute>
                        <xxf:control id="my-currency≡xf-12" class="xbl-fr-currency-suffix"/>
                        <xxf:attribute for="my-currency≡xf-12" name="style">display: none</xxf:attribute>
                        <xxf:control id="my-currency≡xf-15" class="xbl-fr-currency-decimal-separator">.</xxf:control>
                        <xxf:attribute for="my-currency≡xf-15" name="style">display: none</xxf:attribute>
                        <xxf:control id="my-currency≡xf-18" class="xbl-fr-currency-grouping-separator">,</xxf:control>
                        <xxf:attribute for="my-currency≡xf-18" name="style">display: none</xxf:attribute>
                        <xxf:control id="my-currency≡xf-21" class="xbl-fr-currency-digits-after-decimal">2</xxf:control>
                        <xxf:attribute for="my-currency≡xf-21" name="style">display: none</xxf:attribute>
                        <xxf:control id="my-currency≡xf-29" class="xbl-fr-number-xforms-input xforms-hidden">12.34</xxf:control>
                        <xxf:control class="fr-width-10em input-prepend" id="my-currency≡xf-30"/>
                        <xxf:control id="my-currency≡xf-32" class="add-on"/>
                        <xxf:control id="my-currency≡xf-33">$</xxf:control>
                        <xxf:control id="my-currency≡xf-34" class="add-on" relevant="false"/>
                        <xxf:control id="my-currency≡xf-35" relevant="false"/>
                        <xxf:control id="my-currency≡xf-36" relevant="false"/>
                    </xxf:control-values>
                    <xxf:script name="xf_01d33a0f45056a1c82a2217322761ac96dcf3673" target-id="my-currency≡formatted-value" observer-id="my-currency≡xf-5"/>
                    <xxf:script name="xf_3d8d3c03734d8364587001d7d7575079cede66dd" target-id="my-currency" observer-id="my-currency"/>
                </xxf:action>
            </xxf:event-response>
        </output>
    </test>

    <test description="xf:setfocus on fr:autocomplete" name="oxf:pipeline">
        <input name="config" href="wrap-xforms-state.xpl"/>
        <input name="document">
            <xh:html xmlns:xxf="http://orbeon.org/oxf/xml/xforms" xmlns:fr="http://orbeon.org/oxf/xml/form-runner">
                <xh:head>
                    <xf:model id="model">
                        <xf:instance id="instance">
                            <instance xmlns="">
                                <value>One</value>
                                <item>One</item>
                                <item>Two</item>
                                <item>Three</item>
{'fraction_non_alphanumeric': 0.14395735448367028, 'fraction_numerical': 0.01426785637311953, 'mean_word_length': 1.2220874173876952, 'pattern_counts': {'":': 0, '<': 1186, '<?xml version=': 0, '>': 1186, 'https://': 0, 'lorem ipsum': 0, 'www.': 32, 'xml': 168}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 152, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4156444', 'n_tokens_mistral': 19699, 'n_tokens_neox': 18660, 'n_words': 2624}