Redesign of xapp:select


this is a proposal for a redesign of the xapp:select tag.

The general idea is that the xquery should return documents containing both the value and the text for an option element of an HTML select tag.

The signature

<xapp:select collection="..." xquery="..." text="..." value="..." distinct="..." >
   <select ...> 
</pre><BR><BR>Attribute <B>collection</B>: collection where to send the xquery<BR>Attribute <B>xquery</B>: xquery that returns a set of documents.<BR>Attribute <B>value</B>: XPath expression to address a single node of the document<BR>Attribute <B>text</B>: XPath expression to address a single node of the document<BR>Attribute <B>distinct</B>: true or false<BR><BR>Each document of the xquery result is internally processed in the following way:<BR>1) The XPath of the attribute 'value' is evaluated. <BR>2) If resulting value exists, the XPath of the attribute text is evaluated.<BR>3) An entry to the select tag is made of the form<BR><pre class="ip-ubbcode-code-pre">
    <option value="result of XPath of 'value'">result of XPath of 'text'</option>
</pre><BR><BR>Special rules:<BR><BR>1) the attribute 'distinct' controls if a value may occur only once: If 'distict' is true the option element is added to the HTML select tag only if there was no former entry with the same value.<BR>2) if the attribute 'text' is not set, the XPath of text is identical with the XPath of value.<BR><BR>For the post of Joel (see <A HREF="" TARGET=_blank>select with ino:id as value</A>), the solution with the new design could look like this<BR><BR><pre class="ip-ubbcode-code-pre">
<xapp:select collection="myCol" 
             xquery="for $x in input()/Property 
                     return <sel>
                     </sel> " 

However, you are free to define the resulting document of the XQuery.

If you have examples where you access one document to provide the ‘value’ and another one that provides the ‘text’, please post this example. Then, we can check if the new approach for the select covers also your example.

Many thanks.



in the contribution section, we have posted an improvement of the xapp:select tag.

Please have a look at xapp:select improvement.