I'm new to xQuery (with existdb), trying to fill in select box options with values from 1 node (Full) of an xml file and setting another node (corto) to be the parameter sent for further queries, unfortunately unsuccessful till now...
The structure of the xml source to the select control is:
<?xml version="1.0" encoding="UTF-8"?>
<canales>
<Canal>
<corto>24H</corto>
<Full>24H</Full>
</Canal>
<Canal>
<corto>ALJZ</corto>
<Full>AL JAZEERA</Full>
</Canal>
....
No problems when sharing just 1 parameter for both presentation on screen and to pass it to other functions:
declare function app:Lista_canales($node as node()*, $model as map(*)){
let $nombre_canal := (doc(concat($config:data-root, '/','canales.xml')))
let $control :=
<select name="n_canal" class="form-control">
<option value ="">Select channel</option>
{for $canall in $nombre_canal//corto
return <option value="{$canall}">{$canall}</option>
}
</select>
return
templates:form-control($control, $model)
};
Problems appear if I try to use the (more meaningful) Full name for the select list while keeping the other to pass it to other queries. This code does not do what I want:
declare function app:Lista_canales($node as node()*, $model as map(*)){
let $nombre_canal := (doc(concat($config:data-root, '/','canales.xml')))
let $control :=
<select name="n_canal" class="form-control">
<option value ="">Select channel</option>
{for $canall in $nombre_canal
return <option value="{$canall//corto}">{$canall//Full}</option>
}
</select>
return
templates:form-control($control, $model)
};
Any advice/hints will be welcomed.