<?xml-stylesheet type="text/xsl" href="/exist/rest/db/apps/xsltforms/xsltforms.xsl"?><?xsltforms-options debug="yes"?>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>WIKIPEDIA OpenSearch Test Form</title>
        <xf:model xmlns:xf="http://www.w3.org/2002/xforms">
            <xf:instance id="isearch">
                <root xmlns="">
                    <search/>
                </root>
            </xf:instance>
            <xf:instance id="iresults">
                <root xmlns=""/>
            </xf:instance>
            <xf:bind nodeset="search" constraint="instance('iresults')/*[2]/*[translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz') = translate(current(),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')]"/>
            <xf:submission id="s1" method="get" replace="instance" instance="iresults" serialization="none" mode="synchronous" mediatype="text/jsonp">
                <xf:resource value="concat('http://en.wikipedia.org/w/api.php?action=opensearch&amp;format=json&amp;search=',search)"/>
            </xf:submission>
            <xf:setfocus xmlns:ev="http://www.w3.org/2001/xml-events" ev:event="xforms-ready" control="search"/>
        </xf:model>
        <style type="text/css">
			#search label { float: left; width: 4em; }
			#results { border:1px solid black; width: 15em; margin-left: 4em;}
			#results .xforms-value:hover { background-color: #418ad5; }
			input {width:25em;}
		</style>
        <style type="text/css">
    body {
        margin-left:2em;
        margin-top:2em;
        font-size:110%;
    }
    input {
        margin-left:1em;
        margin-right:1em;
    }
    #xsltforms_console {
        margin-top:3em;
        padding-top:1em;
        font-size:75%;
        }
    iframe {
        display:none;
    }
    #xsltforms_debug {
        padding-bottom:1em;
    }
    
    .btn {
    -moz-border-bottom-colors: none;
    -moz-border-left-colors: none;
    -moz-border-right-colors: none;
    -moz-border-top-colors: none;
    background-color: #F5F5F5;
    background-image: linear-gradient(to bottom, #FFFFFF, #E6E6E6);
    background-repeat: repeat-x;
    border-bottom-color: #A2A2A2;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    border-bottom-style: solid;
    border-bottom-width: 1px;
    border-image-outset: 0 0 0 0;
    border-image-repeat: stretch stretch;
    border-image-slice: 100% 100% 100% 100%;
    border-image-source: none;
    border-image-width: 1 1 1 1;
    border-left-color-ltr-source: physical;
    border-left-color-rtl-source: physical;
    border-left-color-value: #BBBBBB;
    border-left-style-ltr-source: physical;
    border-left-style-rtl-source: physical;
    border-left-style-value: solid;
    border-left-width-ltr-source: physical;
    border-left-width-rtl-source: physical;
    border-left-width-value: 1px;
    border-right-color-ltr-source: physical;
    border-right-color-rtl-source: physical;
    border-right-color-value: #BBBBBB;
    border-right-style-ltr-source: physical;
    border-right-style-rtl-source: physical;
    border-right-style-value: solid;
    border-right-width-ltr-source: physical;
    border-right-width-rtl-source: physical;
    border-right-width-value: 1px;
    border-top-color: #BBBBBB;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    border-top-style: solid;
    border-top-width: 1px;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(0, 0, 0, 0.05);
    color: #333333;
    cursor: pointer;
    display: inline-block;
    font-size: 14px;
    line-height: 20px;
    margin-top:1em;
    margin-bottom:1em;
    padding-bottom: 4px;
    padding-left: 12px;
    padding-right: 12px;
    padding-top: 4px;
    text-align: center;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
    vertical-align: middle;
    }
    .btn:hover, .btn:active, .btn.active, .btn.disabled, .btn[disabled] {
    background-color: #E6E6E6;
    color: #333333;
    }
    .btn:active, .btn.active {
    }
    .btn:first-child {
    }
    .btn:hover {
    -moz-text-blink: none;
    -moz-text-decoration-color: -moz-use-text-color;
    -moz-text-decoration-line: none;
    -moz-text-decoration-style: solid;
    background-color: #E6E6E6;
    background-position: 0 -15px;
    color: #333333;
    transition-delay: 0s;
    transition-duration: 0.1s;
    transition-property: background-position;
    transition-timing-function: linear;
    }
    .btn:focus {
    outline-color: #333333;
    outline-offset: -2px;
    outline-style: dotted;
    outline-width: thin;
    }
    .btn.active, .btn:active {
    background-color: #E6E6E6;
    background-image: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15) inset, 0 1px 2px rgba(0, 0, 0, 0.05);
    outline-color: -moz-use-text-color;
    outline-style: none;
    outline-width: 0;
    }
    a {
    text-decoration:none;
    color: #0088CC;
    }
    a:hover {
    -moz-text-blink: none;
    -moz-text-decoration-color: -moz-use-text-color;
    -moz-text-decoration-line: underline;
    -moz-text-decoration-style: solid;
    color: #005580;
    }
    .xforms-value {margin-left:1em;}
    .description {
        color: gray;
        margin-top:2em;
        font-size: 80%;}
</style>
    </head>
    <body>
        <div class="source">
            <div class="toolbar">
                <a class="btn" href="/exist/apps/eXide/index.html?open=/db/apps/XSLTForms-Demo/data/wikipediasearch.xml" target="eXide" data-type="XML" title="Opens the form in eXide.">Open form in eXide</a>
            </div>
        </div>
        <h1>Wikipedia OpenSearch Test Form</h1>
        <p>Please enter a subject in the following field. The value is not case sensitive but it has to exist in the results of the corresponding search.</p>
        <xf:input xmlns:xf="http://www.w3.org/2002/xforms" id="search" ref="search" incremental="true" delay="500">
            <xf:label>Subject : </xf:label>
            <xf:send xmlns:ev="http://www.w3.org/2001/xml-events" submission="s1" ev:event="xforms-value-changed"/>
            <xf:toggle xmlns:ev="http://www.w3.org/2001/xml-events" ev:event="DOMFocusIn" case="show-autocompletion"/>
        </xf:input>
        <xf:switch xmlns:xf="http://www.w3.org/2002/xforms">
            <xf:case id="show-autocompletion">
                <xf:repeat id="results" nodeset="instance('iresults')/*[2]/*">
                    <xf:trigger appearance="minimal">
                        <xf:label>
                            <xf:output value="."/>
                        </xf:label>
                        <xf:action xmlns:ev="http://www.w3.org/2001/xml-events" ev:event="DOMActivate">
                            <xf:setvalue ref="instance('isearch')/search" value="instance('iresults')/*[2]/*[index('results')]"/>
                            <xf:toggle case="hide-autocompletion"/>
                        </xf:action>
                    </xf:trigger>
                </xf:repeat>
            </xf:case>
            <xf:case id="hide-autocompletion"/>
        </xf:switch>
        <div xmlns="" class="description">
            <description>Searches for page titles beginning with the entered prefix, for use in completion of input in a search box or the like.</description>
        </div>
    </body>
</html>