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 , <basex-talk-request@mailman.uni-konstanz.de> 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-request@mailman.uni-konstanz.de
You can reach the person managing the list at
basex-talk-owner@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 <m.lettere@gmail.com>
To: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: [basex-talk] RESTXQ and regexp
Message-ID: <3f71e0bc-e16d-6c4d-6ee8-246a7cc7595c@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
*******************************************