<commit_before><!--
    Copyright (C) 2005 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
-->
<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:widget="http://orbeon.org/oxf/xml/widget"
    xmlns:ev="http://www.w3.org/2001/xml-events">
    
    <xhtml:head>
        <xhtml:title>XForms Controls</xhtml:title>
        <xhtml:style type="text/css">
            .controls-range { margin-top: 1em; margin-bottom: 2em; }
        </xhtml:style>
        <xforms:model xmlns:xforms="http://www.w3.org/2002/xforms"
                xmlns:xs="http://www.w3.org/2001/XMLSchema" id="main-model">
            <xforms:action ev:event="xforms-ready">
                <xforms:send submission="countries-submission"/>
                <xforms:refresh model="main-model"/>
            </xforms:action>
            <xforms:instance id="instance">
                <!-- Here we illustrate how an XForms instance can be included with XInclude -->
                <xi:include href="main-xforms-instance.xml"/>
            </xforms:instance>
            <xforms:instance id="items">
                <items>
                    <flavors>
                        <flavor value="v">
                            <label>Vanilla</label>
                        </flavor>
                        <flavor value="s">
                            <label>Strawberry</label>
                        </flavor>
                        <flavor value="c">
                            <label>Chocolate</label>
                        </flavor>
                    </flavors>
                    <carriers>
                        <carrier value="ups">
                            <label>UPS</label>
                        </carrier>
                        <carrier value="fedex">
                            <label>FedEx</label>
                        </carrier>
                        <carrier value="dhl">
                            <label>DHL</label>
                        </carrier>
                    </carriers>
                </items>
            </xforms:instance>
            <!-- List of countries for name select1 -->
            <xforms:instance id="countries-name" src="xforms-controls/countries"/>
            <xforms:instance id="formatted">
                <formated-instance>
                    &lt;span>
                    &lt;/span>
                </formated-instance>
            </xforms:instance>
            <xforms:instance id="countries">
                <countries letter=""/>
            </xforms:instance>
            <xforms:instance id="country-details">
                <country us-code="">
                    No country selected
                </country>
            </xforms:instance>
            <xforms:instance id="ui">
                <ui>
                    <show-instance>false</show-instance>
                </ui>
            </xforms:instance>

            <xforms:bind nodeset="instance('instance')">
                <xforms:bind nodeset="age" constraint="number(.) >= 0 and number(.) &lt;= 150"/>
                <xforms:bind nodeset="secret" constraint="string(.) = '42'"/>
                <xforms:bind nodeset="textarea" constraint="string-length(.) > 10"/>
                <xforms:bind nodeset="date" type="xs:date"/>
                <!--<xforms:bind nodeset="time" type="xs:time"/>-->
                <xforms:bind nodeset="range/value" type="xs:integer"/>
                <xforms:bind nodeset="range/letter" calculate="
                    for $value in ../value return
                        ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
                        'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z')[xs:integer($value)]"/>
            </xforms:bind>
            <xforms:bind nodeset="instance('countries')/@letter"
                calculate="instance('instance')/range/letter"/>
            <xforms:bind nodeset="instance('country-details')/@us-code"
                calculate="instance('instance')/country"/>
            <xforms:bind nodeset="instance('formatted')"
                calculate="saxon:serialize(xxforms:call-xpl
                    ('oxf:/config/theme/format.xpl', 'data', instance('instance'), 'data')/*, 'html')"/>
            <xforms:bind nodeset="instance('ui')/show-instance" relevant=". = 'true'"/>

            <xforms:submission ref="instance('countries')" id="countries-submission"
                method="post" action="/xforms-controls/update-countries" replace="instance"/>
            <xforms:submission ref="instance('country-details')" id="country-details-submission"
                method="post" action="/xforms-controls/update-country-details" replace="instance"/>
            <!-- Submission when country name changed -->
            <xforms:submission ref="instance('instance')" id="country-name-updated"
                method="post" action="/direct/xforms-controls/countries" replace="instance" instance="countries-name"/>
        </xforms:model>
    </xhtml:head>
    <xhtml:body>
        <xforms:group ref="instance('instance')">
            <widget:tabs>
                <widget:tab id="text-controls">
                    <widget:label>Text controls</widget:label>
                    <xhtml:p>
                        <xforms:input ref="age" incremental="true">
                            <xforms:label class="fixed-width">Age:</xforms:label>
                            <xforms:hint>Positive number</xforms:hint>
                        </xforms:input>
                    </xhtml:p>
                    <xhtml:p>
                        <xforms:secret ref="secret" incremental="true">
                            <xforms:label class="fixed-width">Password:</xforms:label>
                            <xforms:hint>The password is 42 ;)</xforms:hint>
                            <xforms:alert>Invalid password</xforms:alert>
                        </xforms:secret>
                    </xhtml:p>
                    <xhtml:p>
                        <xforms:textarea ref="textarea">
                            <xforms:label class="fixed-width">Text area:</xforms:label>
                            <xforms:hint>Enter at least 11 characters</xforms:hint>
                            <xforms:alert>Content of text area has less than 10 characters</xforms:alert>
                        </xforms:textarea>
                    </xhtml:p>
                    <xhtml:p>
                        <xforms:input ref="date">
                            <xforms:label class="fixed-width">Birth date:</xforms:label>
                            <xforms:help>
                                This is supposed to be a help message explaining what a birth date is.
                                But since you already know, it mostly serves the purpose of showing how
                                help messages can be attached to controls, and that they can be pretty
                                long as they can be displayed on multiple lines.
                            </xforms:help>
                        </xforms:input>
                    </xhtml:p>
                </widget:tab>
                <widget:tab id="selection-controls" selected="true">
                    <widget:label>Selection controls</widget:label>
                    <xforms:group>
                        <xforms:label>Single Value Selection</xforms:label>
                        <xhtml:p>
                            <xforms:select1 ref="carrier" appearance="full">
                                <xforms:label class="fixed-width">Carrier:</xforms:label>
                                <xforms:itemset nodeset="instance('items')/carriers/carrier">
                                    <xforms:label ref="label"/>
                                    <xforms:value ref="@value"/>
                                </xforms:itemset>
                            </xforms:select1>
                        </xhtml:p>
                        <xhtml:p>
                            <xforms:select1 ref="carrier" appearance="compact">
                                <xforms:label class="fixed-width"/>
                                <xforms:itemset nodeset="instance('items')/carriers/carrier">
                                    <xforms:label ref="label"/>
                                    <xforms:value ref="@value"/>
                                </xforms:itemset>
                            </xforms:select1>
                        </xhtml:p>
                        <xhtml:p>
                            <xforms:select1 ref="carrier" appearance="minimal">
                                <xforms:label class="fixed-width"/>
                                <xforms:itemset nodeset="instance('items')/carriers/carrier">
                                    <xforms:label ref="label"/>
                                    <xforms:value ref="@value"/>
                                </xforms:itemset>
                            </xforms:select1>
                        </xhtml:p>
                    </xforms:group>
                    <xforms:group>
                        <xforms:label>Multiple Value Selection</xforms:label>
                        <xhtml:p>
                            <xforms:select ref="flavor" appearance="full">
                                <xforms:label class="fixed-width">Flavor:</xforms:label>
                                <xforms:itemset nodeset="instance('items')/flavors/flavor">
                                    <xforms:label ref="label"/>
                                    <xforms:value ref="@value"/>
                                </xforms:itemset>
                            </xforms:select>
                        </xhtml:p>
                        <xhtml:p>
                            <xforms:select ref="flavor" appearance="compact">
                                <xforms:label class="fixed-width"/>
                                <xforms:itemset nodeset="instance('items')/flavors/flavor">
                                    <xforms:label ref="label"/>
                                    <xforms:value ref="@value"/>
                                </xforms:itemset>
                            </xforms:select>
                        </xhtml:p>
                    </xforms:group>
                    <xforms:group>
                        <xforms:label>Add</xforms:label>
                        <xhtml:p>
                            <xforms:input ref="new-item/label">
                                <xforms:label class="fixed-width">Label:</xforms:label>
                            </xforms:input>
                        </xhtml:p>
                        <xhtml:p>
                            <xforms:input ref="new-item/value">
                                <xforms:label class="fixed-width">Value:</xforms:label>
                            </xforms:input>
                        </xhtml:p>
                        <xhtml:p>
                            <xhtml:span class="fixed-width"/>
                            <xforms:trigger>
                                <xforms:label>Add carrier</xforms:label>
                                <xforms:action  ev:event="DOMActivate">
                                    <xforms:insert nodeset="instance('items')/carriers/carrier"
                                        at="last()" position="after"/>
                                    <xforms:setvalue ref="instance('items')/carriers/carrier[last()]/@value"
                                        value="instance('instance')/new-item/value"/>
                                    <xforms:setvalue ref="instance('items')/carriers/carrier[last()]/label"
                                        value="instance('instance')/new-item/label"/>
                                </xforms:action>
                            </xforms:trigger>
                            <xforms:trigger>
                                <xforms:label>Add flavor</xforms:label>
                                <xforms:action  ev:event="DOMActivate">
                                    <xforms:insert nodeset="instance('items')/flavors/flavor"
                                        at="last()" position="after"/>
                                    <xforms:setvalue ref="instance('items')/flavors/flavor[last()]/@value"
                                        value="instance('instance')/new-item/value"/>
                                    <xforms:setvalue ref="instance('items')/flavors/flavor[last()]/label"
                                        value="instance('instance')/new-item/label"/>
                                </xforms:action>
                            </xforms:trigger>
                        </xhtml:p>
                    </xforms:group>
                    <xforms:group>
                        <xforms:label>Auto-Complete</xforms:label>
                        <xhtml:p>
                            <!-- Auto-complete for country name -->
                            <xforms:select1 ref="instance('instance')/country-name" selection="open" id="country-name" incremental="true" appearance="xxforms:autocomplete" xxforms:filter="true">
                                <xforms:label class="label">Enter a country name: </xforms:label>
                                <xforms:itemset nodeset="instance('countries-name')/country">
                                    <xforms:label ref="name"/>
                                    <xforms:value ref="name"/>
                                </xforms:itemset>
                                <xforms:send submission="country-name-updated" ev:event="xforms-value-changed"/>
                            </xforms:select1>
                        </xhtml:p>
                        <xhtml:p>
                            <!-- Display flag of selected country -->
                            <xforms:output
                                value="for $c in instance('countries-name')/country[name = instance('instance')/country-name] return
                                       if ($c) then
                                           concat(
                                            '&lt;img',
                                              ' src=&#34;../images/flags/',
                                                $c/us-code,
                                                '-flag.gif&#34;',
                                            '/&gt;'
                                           )
                                       else
                                           ''"
                                    mediatype="text/html"/>
                        </xhtml:p>
                    </xforms:group>

                </widget:tab>
                <widget:tab id="slider">
                    <widget:label>Range</widget:label>
                    <xhtml:div class="controls-range">
                        <xforms:range ref="range/value" start="1" end="26">
                            <xforms:action ev:event="xforms-value-changed">
                                <xforms:recalculate/>
                                <xforms:send submission="countries-submission"/>
                            </xforms:action>
                        </xforms:range>
                    </xhtml:div>
                    <xhtml:p>
                        Countries starting with letter
                        <xhtml:b><xforms:output ref="range/letter"/></xhtml:b>
                    </xhtml:p>
                    <xhtml:p>
                        <xforms:select1 ref="country" appearance="compact" style="height: 8em">
                            <xforms:itemset nodeset="instance('countries')/country">
                                <xforms:label ref="name"/>
                                <xforms:value ref="us-code"/>
                            </xforms:itemset>
                            <xforms:send submission="country-details-submission" ev:event="xforms-value-changed"/>
                        </xforms:select1>
                    </xhtml:p>
                    <xforms:output ref="instance('country-details')" mediatype="text/html"/>
                </widget:tab>
            </widget:tabs>
            <xhtml:p style="margin-top: 2em">
                <xforms:switch>
                    <xforms:case id="instance-hidden">
                        <xforms:trigger>
                            <xforms:label>Show instance</xforms:label>
                            <xforms:toggle ev:event="DOMActivate" case="instance-visible"/>
                        </xforms:trigger>
                    </xforms:case>
                    <xforms:case id="instance-visible">
                        <xforms:trigger>
                            <xforms:label>Hide instance</xforms:label>
                            <xforms:toggle ev:event="DOMActivate" case="instance-hidden"/>
                        </xforms:trigger>
                        <xforms:group>
                            <xforms:label>XForms instance</xforms:label>
                            <xforms:output ref="instance('formatted')" mediatype="text/html"/>
                        </xforms:group>
                    </xforms:case>
                </xforms:switch>
            </xhtml:p>
        </xforms:group>
    </xhtml:body>
</xhtml:html>
<commit_msg>Make text controls again the default selection<commit_after><!--
    Copyright (C) 2005 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
-->
<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:widget="http://orbeon.org/oxf/xml/widget"
    xmlns:ev="http://www.w3.org/2001/xml-events">
    
    <xhtml:head>
        <xhtml:title>XForms Controls</xhtml:title>
        <xhtml:style type="text/css">
            .controls-range { margin-top: 1em; margin-bottom: 2em; }
        </xhtml:style>
        <xforms:model xmlns:xforms="http://www.w3.org/2002/xforms"
                xmlns:xs="http://www.w3.org/2001/XMLSchema" id="main-model">
            <xforms:action ev:event="xforms-ready">
                <xforms:send submission="countries-submission"/>
                <xforms:refresh model="main-model"/>
            </xforms:action>
            <xforms:instance id="instance">
                <!-- Here we illustrate how an XForms instance can be included with XInclude -->
                <xi:include href="main-xforms-instance.xml"/>
            </xforms:instance>
            <xforms:instance id="items">
                <items>
                    <flavors>
                        <flavor value="v">
                            <label>Vanilla</label>
                        </flavor>
                        <flavor value="s">
                            <label>Strawberry</label>
                        </flavor>
                        <flavor value="c">
                            <label>Chocolate</label>
                        </flavor>
                    </flavors>
                    <carriers>
                        <carrier value="ups">
                            <label>UPS</label>
                        </carrier>
                        <carrier value="fedex">
                            <label>FedEx</label>
                        </carrier>
                        <carrier value="dhl">
                            <label>DHL</label>
                        </carrier>
                    </carriers>
                </items>
            </xforms:instance>
            <!-- List of countries for name select1 -->
            <xforms:instance id="countries-name" src="xforms-controls/countries"/>
            <xforms:instance id="formatted">
                <formated-instance>
                    &lt;span>
                    &lt;/span>
                </formated-instance>
            </xforms:instance>
            <xforms:instance id="countries">
                <countries letter=""/>
            </xforms:instance>
            <xforms:instance id="country-details">
                <country us-code="">
                    No country selected
                </country>
            </xforms:instance>
            <xforms:instance id="ui">
                <ui>
                    <show-instance>false</show-instance>
                </ui>
            </xforms:instance>

            <xforms:bind nodeset="instance('instance')">
                <xforms:bind nodeset="age" constraint="number(.) >= 0 and number(.) &lt;= 150"/>
                <xforms:bind nodeset="secret" constraint="string(.) = '42'"/>
                <xforms:bind nodeset="textarea" constraint="string-length(.) > 10"/>
                <xforms:bind nodeset="date" type="xs:date"/>
                <!--<xforms:bind nodeset="time" type="xs:time"/>-->
                <xforms:bind nodeset="range/value" type="xs:integer"/>
                <xforms:bind nodeset="range/letter" calculate="
                    for $value in ../value return
                        ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
                        'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z')[xs:integer($value)]"/>
            </xforms:bind>
            <xforms:bind nodeset="instance('countries')/@letter"
                calculate="instance('instance')/range/letter"/>
            <xforms:bind nodeset="instance('country-details')/@us-code"
                calculate="instance('instance')/country"/>
            <xforms:bind nodeset="instance('formatted')"
                calculate="saxon:serialize(xxforms:call-xpl
                    ('oxf:/config/theme/format.xpl', 'data', instance('instance'), 'data')/*, 'html')"/>
            <xforms:bind nodeset="instance('ui')/show-instance" relevant=". = 'true'"/>

            <xforms:submission ref="instance('countries')" id="countries-submission"
                method="post" action="/xforms-controls/update-countries" replace="instance"/>
            <xforms:submission ref="instance('country-details')" id="country-details-submission"
                method="post" action="/xforms-controls/update-country-details" replace="instance"/>
            <!-- Submission when country name changed -->
            <xforms:submission ref="instance('instance')" id="country-name-updated"
                method="post" action="/direct/xforms-controls/countries" replace="instance" instance="countries-name"/>
        </xforms:model>
    </xhtml:head>
    <xhtml:body>
        <xforms:group ref="instance('instance')">
            <widget:tabs>
                <widget:tab id="text-controls" selected="true">
                    <widget:label>Text controls</widget:label>
                    <xhtml:p>
                        <xforms:input ref="age" incremental="true">
                            <xforms:label class="fixed-width">Age:</xforms:label>
                            <xforms:hint>Positive number</xforms:hint>
                        </xforms:input>
                    </xhtml:p>
                    <xhtml:p>
                        <xforms:secret ref="secret" incremental="true">
                            <xforms:label class="fixed-width">Password:</xforms:label>
                            <xforms:hint>The password is 42 ;)</xforms:hint>
                            <xforms:alert>Invalid password</xforms:alert>
                        </xforms:secret>
                    </xhtml:p>
                    <xhtml:p>
                        <xforms:textarea ref="textarea">
                            <xforms:label class="fixed-width">Text area:</xforms:label>
                            <xforms:hint>Enter at least 11 characters</xforms:hint>
                            <xforms:alert>Content of text area has less than 10 characters</xforms:alert>
                        </xforms:textarea>
                    </xhtml:p>
                    <xhtml:p>
                        <xforms:input ref="date">
                            <xforms:label class="fixed-width">Birth date:</xforms:label>
                            <xforms:help>
                                This is supposed to be a help message explaining what a birth date is.
                                But since you already know, it mostly serves the purpose of showing how
                                help messages can be attached to controls, and that they can be pretty
                                long as they can be displayed on multiple lines.
                            </xforms:help>
                        </xforms:input>
                    </xhtml:p>
                </widget:tab>
                <widget:tab id="selection-controls">
                    <widget:label>Selection controls</widget:label>
                    <xforms:group>
                        <xforms:label>Single Value Selection</xforms:label>
                        <xhtml:p>
                            <xforms:select1 ref="carrier" appearance="full">
                                <xforms:label class="fixed-width">Carrier:</xforms:label>
                                <xforms:itemset nodeset="instance('items')/carriers/carrier">
                                    <xforms:label ref="label"/>
                                    <xforms:value ref="@value"/>
                                </xforms:itemset>
                            </xforms:select1>
                        </xhtml:p>
                        <xhtml:p>
                            <xforms:select1 ref="carrier" appearance="compact">
                                <xforms:label class="fixed-width"/>
                                <xforms:itemset nodeset="instance('items')/carriers/carrier">
                                    <xforms:label ref="label"/>
                                    <xforms:value ref="@value"/>
                                </xforms:itemset>
                            </xforms:select1>
                        </xhtml:p>
                        <xhtml:p>
                            <xforms:select1 ref="carrier" appearance="minimal">
                                <xforms:label class="fixed-width"/>
                                <xforms:itemset nodeset="instance('items')/carriers/carrier">
                                    <xforms:label ref="label"/>
                                    <xforms:value ref="@value"/>
                                </xforms:itemset>
                            </xforms:select1>
                        </xhtml:p>
                    </xforms:group>
                    <xforms:group>
                        <xforms:label>Multiple Value Selection</xforms:label>
                        <xhtml:p>
                            <xforms:select ref="flavor" appearance="full">
                                <xforms:label class="fixed-width">Flavor:</xforms:label>
                                <xforms:itemset nodeset="instance('items')/flavors/flavor">
                                    <xforms:label ref="label"/>
                                    <xforms:value ref="@value"/>
                                </xforms:itemset>
                            </xforms:select>
                        </xhtml:p>
                        <xhtml:p>
                            <xforms:select ref="flavor" appearance="compact">
                                <xforms:label class="fixed-width"/>
                                <xforms:itemset nodeset="instance('items')/flavors/flavor">
                                    <xforms:label ref="label"/>
                                    <xforms:value ref="@value"/>
                                </xforms:itemset>
                            </xforms:select>
                        </xhtml:p>
                    </xforms:group>
                    <xforms:group>
                        <xforms:label>Add</xforms:label>
                        <xhtml:p>
                            <xforms:input ref="new-item/label">
                                <xforms:label class="fixed-width">Label:</xforms:label>
                            </xforms:input>
                        </xhtml:p>
                        <xhtml:p>
                            <xforms:input ref="new-item/value">
                                <xforms:label class="fixed-width">Value:</xforms:label>
                            </xforms:input>
                        </xhtml:p>
                        <xhtml:p>
                            <xhtml:span class="fixed-width"/>
                            <xforms:trigger>
                                <xforms:label>Add carrier</xforms:label>
                                <xforms:action  ev:event="DOMActivate">
                                    <xforms:insert nodeset="instance('items')/carriers/carrier"
                                        at="last()" position="after"/>
                                    <xforms:setvalue ref="instance('items')/carriers/carrier[last()]/@value"
                                        value="instance('instance')/new-item/value"/>
                                    <xforms:setvalue ref="instance('items')/carriers/carrier[last()]/label"
                                        value="instance('instance')/new-item/label"/>
                                </xforms:action>
                            </xforms:trigger>
                            <xforms:trigger>
                                <xforms:label>Add flavor</xforms:label>
                                <xforms:action  ev:event="DOMActivate">
                                    <xforms:insert nodeset="instance('items')/flavors/flavor"
                                        at="last()" position="after"/>
                                    <xforms:setvalue ref="instance('items')/flavors/flavor[last()]/@value"
                                        value="instance('instance')/new-item/value"/>
                                    <xforms:setvalue ref="instance('items')/flavors/flavor[last()]/label"
                                        value="instance('instance')/new-item/label"/>
                                </xforms:action>
                            </xforms:trigger>
                        </xhtml:p>
                    </xforms:group>
                    <xforms:group>
                        <xforms:label>Auto-Complete</xforms:label>
                        <xhtml:p>
                            <!-- Auto-complete for country name -->
                            <xforms:select1 ref="instance('instance')/country-name" selection="open" id="country-name" incremental="true" appearance="xxforms:autocomplete" xxforms:filter="true">
                                <xforms:label class="label">Enter a country name: </xforms:label>
                                <xforms:itemset nodeset="instance('countries-name')/country">
                                    <xforms:label ref="name"/>
                                    <xforms:value ref="name"/>
                                </xforms:itemset>
                                <xforms:send submission="country-name-updated" ev:event="xforms-value-changed"/>
                            </xforms:select1>
                        </xhtml:p>
                        <xhtml:p>
                            <!-- Display flag of selected country -->
                            <xforms:output
                                value="for $c in instance('countries-name')/country[name = instance('instance')/country-name] return
                                       if ($c) then
                                           concat(
                                            '&lt;img',
                                              ' src=&#34;../images/flags/',
                                                $c/us-code,
                                                '-flag.gif&#34;',
                                            '/&gt;'
                                           )
                                       else
                                           ''"
                                    mediatype="text/html"/>
                        </xhtml:p>
                    </xforms:group>

                </widget:tab>
                <widget:tab id="slider">
                    <widget:label>Range</widget:label>
                    <xhtml:div class="controls-range">
                        <xforms:range ref="range/value" start="1" end="26">
                            <xforms:action ev:event="xforms-value-changed">
                                <xforms:recalculate/>
                                <xforms:send submission="countries-submission"/>
                            </xforms:action>
                        </xforms:range>
                    </xhtml:div>
                    <xhtml:p>
                        Countries starting with letter
                        <xhtml:b><xforms:output ref="range/letter"/></xhtml:b>
                    </xhtml:p>
                    <xhtml:p>
                        <xforms:select1 ref="country" appearance="compact" style="height: 8em">
                            <xforms:itemset nodeset="instance('countries')/country">
                                <xforms:label ref="name"/>
                                <xforms:value ref="us-code"/>
                            </xforms:itemset>
                            <xforms:send submission="country-details-submission" ev:event="xforms-value-changed"/>
                        </xforms:select1>
                    </xhtml:p>
                    <xforms:output ref="instance('country-details')" mediatype="text/html"/>
                </widget:tab>
            </widget:tabs>
            <xhtml:p style="margin-top: 2em">
                <xforms:switch>
                    <xforms:case id="instance-hidden">
                        <xforms:trigger>
                            <xforms:label>Show instance</xforms:label>
                            <xforms:toggle ev:event="DOMActivate" case="instance-visible"/>
                        </xforms:trigger>
                    </xforms:case>
                    <xforms:case id="instance-visible">
                        <xforms:trigger>
                            <xforms:label>Hide instance</xforms:label>
                            <xforms:toggle ev:event="DOMActivate" case="instance-hidden"/>
                        </xforms:trigger>
                        <xforms:group>
                            <xforms:label>XForms instance</xforms:label>
                            <xforms:output ref="instance('formatted')" mediatype="text/html"/>
                        </xforms:group>
                    </xforms:case>
                </xforms:switch>
            </xhtml:p>
        </xforms:group>
    </xhtml:body>
</xhtml:html>

{'fraction_non_alphanumeric': 0.12347252625453739, 'fraction_numerical': 0.003990135498351298, 'mean_word_length': 1.1409503470368394, 'pattern_counts': {'":': 0, '<': 603, '<?xml version=': 0, '>': 611, 'https://': 0, 'lorem ipsum': 0, 'www.': 14, 'xml': 28}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 92, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6437894', 'n_tokens_mistral': 9057, 'n_tokens_neox': 8372, 'n_words': 1450}