Re: [basex-talk] RESTXQ and regexp

2019-02-23 Thread Liam R. E. Quin
On Fri, 2019-02-22 at 12:05 +0100, Marco Lettere wrote:

> (: Matches anything followed by /input :)
> declare %rest:path("app/{$path=.+}/input")
>function page:inputs($path) { ... };
> 
> (: Matches all other all paths starting with "app/" :)
> declare %rest:path("app/{$path=.+}")
>function page:others($path) { ... };

Can you use content negotiation/quality to say the /input one is
preferred when both match? E.g. %rest:produces("*/*;qs=0.8") on the
page:others function and */*;qs=1.0 on the input ont?

Liam


-- 
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Web slave for vintage clipart http://www.fromoldbooks.org/



Re: [basex-talk] BaseX-Talk Digest, Vol 110, Issue 29

2019-02-23 Thread Shaun Flynn
Hello there Marco,

This might be down to the choice of regex.

Assume $path = "path"

app/{$path=.+}

Will match

"app/path=1234"

And

"app/path=1234/input"

Which I think would be matched by ".+" part of the expression, as "/input"
would match ".+".

Kind regards

On Sat, 23 Feb 2019, 11:00 , 
wrote:

> Send BaseX-Talk mailing list submissions to
> basex-talk@mailman.uni-konstanz.de
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
> or, via email, send a message with subject or body 'help' to
> basex-talk-requ...@mailman.uni-konstanz.de
>
> You can reach the person managing the list at
> basex-talk-ow...@mailman.uni-konstanz.de
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of BaseX-Talk digest..."
>
>
> Today's Topics:
>
>1. RESTXQ and regexp (Marco Lettere)
>
>
> --
>
> Message: 1
> Date: Fri, 22 Feb 2019 12:05:29 +0100
> From: Marco Lettere 
> To: BaseX 
> Subject: [basex-talk] RESTXQ and regexp
> Message-ID: <3f71e0bc-e16d-6c4d-6ee8-246a7cc75...@gmail.com>
> Content-Type: text/plain; charset=utf-8; format=flowed
>
> Hello all,
>
> according to the docs this should be possible:
>
> (: Matches all paths with "app" as first, a number as second, and
> "order" as third segment :)
> declare %rest:path("app/{$code=[0-9]+}/order")
>  ? function page:order($full-path) { ... };
>
> (: Matches all other all paths starting with "app/" :)
> declare %rest:path("app/{$path=.+}")
>  ? function page:others($path) { ... };
>
> And it actually is... We are currently in the very unfortunate situation
> where we need the following:
>
> (: Matches anything followed by /input :)
> declare %rest:path("app/{$path=.+}/input")
>  ? function page:inputs($path) { ... };
>
> (: Matches all other all paths starting with "app/" :)
> declare %rest:path("app/{$path=.+}")
>  ? function page:others($path) { ... };
>
> Unfortunately this makes all the calls to be redirected to the
> page:others function ... is there a motivation behind it or could it be
> possible to work around that?
>
> Thanks,
>
> Marco.
>
>
>
> End of BaseX-Talk Digest, Vol 110, Issue 29
> ***
>