Saxon-JS > ixsl:query-params() > url?name=hello&name=world

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Saxon-JS > ixsl:query-params() > url?name=hello&name=world

gary.cornelius
Hi,

I am having problems accessing query string parameters ( ixsl:query-params()
) and wonder if someone can help? My problem occurs when I have a html form
with a multiple select on the page e.g.

<select id="aggressionType" name="aggressionType" multiple="multiple">
    <option value="" disabled="disabled" selected="selected">Select
aggression type</option>
    <option value="againstObjects" data-icon="aggression_objects.png"
class="square">Physical aggression against objects</option>
    <option value="againstOthers" data-icon="aggression_others.png"
class="square">Physical aggression against others</option>
    <option value="againstSelf" data-icon="aggression_self.png"
class="square">Physical aggression against self</option>
    <option value="verbalAggression" data-icon="aggression_verbal.png"
class="square">Verbal Aggression</option>
</select>  

When the nurse/carer selects multiple options we will get a query string
like this:

url?aggressionType=againstObjects&aggressionType=againstOthers&aggressionTyp
e=verbalAgression

I am looking for a way to try to retrieve an aggregated list of all the
aggressionType query parameters values together. However, I only appear to
be able to have access to the last value in the list e.g. <xsl:value-of
select="ixsl:query-params()?aggressionType "/>

I found documentation on the following page but can't identify a way to
access all the values listed above - Is it possible to access all the values
in this URL format?
http://www.saxonica.com/saxon-js/documentation/index.html#!ixsl-extension/fu
nctions/query-params

Many thanks in advance for any help or suggestions!

Best wishes,
Gary

--
 
Rapport Network CIC
Registered in Scotland: SC458540
 
Assisted living technology
for early-stage dementia.



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: Saxon-JS > ixsl:query-params() > url?name=hello&name=world

debbie
The function ixsl:query-params() returns an XDM (XPath 3.1) map, and
since keys are unique in these maps, this will currently only contain
one value for each key. i.e. we have not allowed for selecting multiple
options, as in your example. So this is a bug.

For now, I think you'll need to analyze the query string yourself I'm
afraid. To start, you should be able to use ixsl:get(ixsl:window(),
'location.search') to access the query string.


On 24/10/2016 12:58, [hidden email] wrote:

> Hi,
>
> I am having problems accessing query string parameters ( ixsl:query-params()
> ) and wonder if someone can help? My problem occurs when I have a html form
> with a multiple select on the page e.g.
>
> <select id="aggressionType" name="aggressionType" multiple="multiple">
>      <option value="" disabled="disabled" selected="selected">Select
> aggression type</option>
>      <option value="againstObjects" data-icon="aggression_objects.png"
> class="square">Physical aggression against objects</option>
>      <option value="againstOthers" data-icon="aggression_others.png"
> class="square">Physical aggression against others</option>
>      <option value="againstSelf" data-icon="aggression_self.png"
> class="square">Physical aggression against self</option>
>      <option value="verbalAggression" data-icon="aggression_verbal.png"
> class="square">Verbal Aggression</option>
> </select>
>
> When the nurse/carer selects multiple options we will get a query string
> like this:
>
> url?aggressionType=againstObjects&aggressionType=againstOthers&aggressionTyp
> e=verbalAgression
>
> I am looking for a way to try to retrieve an aggregated list of all the
> aggressionType query parameters values together. However, I only appear to
> be able to have access to the last value in the list e.g. <xsl:value-of
> select="ixsl:query-params()?aggressionType "/>
>
> I found documentation on the following page but can't identify a way to
> access all the values listed above - Is it possible to access all the values
> in this URL format?
> http://www.saxonica.com/saxon-js/documentation/index.html#!ixsl-extension/fu
> nctions/query-params
>
> Many thanks in advance for any help or suggestions!
>
> Best wishes,
> Gary
>
> --
>  
> Rapport Network CIC
> Registered in Scotland: SC458540
>  
> Assisted living technology
> for early-stage dementia.
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>

--
Debbie Lockett
Saxonica



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: Saxon-JS > ixsl:query-params() > url?name=hello&name=world

Michael Kay

> On 24 Oct 2016, at 14:56, Debbie <[hidden email]> wrote:
>
> The function ixsl:query-params() returns an XDM (XPath 3.1) map, and
> since keys are unique in these maps, this will currently only contain
> one value for each key. i.e. we have not allowed for selecting multiple
> options, as in your example. So this is a bug.
>

I guess it would be quite possible (and backwards compatible in the normal case) for us to return a map in which the value is a list containing multiple strings:

map{ "aggressionType" : ("againstOthers", "verbalAggression") }

Michael Kay
Saxonica



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help