- From: Dave Pawson <dave.pawson@gmail.com>
- Date: Thu, 3 Dec 2020 10:32:53 +0000
- To: Michael Kay <mike@saxonica.com>
- Cc: public-xslt-40@w3.org
Certainly logical and consistent, and (to me) clear. Did you consider other verbs(nouns?) other than slice? I'd like to hear an opinion of someone with ESL? regards On Thu, 3 Dec 2020 at 10:27, Michael Kay <mike@saxonica.com> wrote: > > Here's my latest attempt, illustrated by example: > > Note that this (potentially) replaces existing or proposed functions as follows > > head(X) ===> slice(X, 1) > tail(X) ===> slice(X, start:=2) > item-at(X, N) ===> slice(X, N) > foot(X) ===> slice(X, -1) > truncate(X) ===> slice(X, end:=-2) > slice(X, A to B by C) ===> slice(X, start:=A, end:=B, step:=C) > subsequence(X, S, L) ==> slice(X, start:=S, length:=L) > items-before(X, P) ===> slice(X, before:=P) > items-after(X, P) ===> slice(X, after:=P) > items-from(X, P) ===> slice(X, from:=P) > items-until(X, P) ===> slice(X, until:=P) > X[position() gt P] ===> slice(X, start:=P+1) > X[position() = A to B] ===> slice(X, start:=A, end:=B) > X[last()] ===> slice(X, -1) > X[last()-1] ===> slice)X, -2) > > All variants return the results in their original order. > > The expression fn:slice(("a", "b", "c", "d", "e"), at:=2) returns "b". > > The expression fn:slice(("a", "b", "c", "d", "e"), at:=-1) returns "e". > > The expression fn:slice(("a", "b", "c", "d", "e"), at:=0) returns (). > > The expression fn:slice(("a", "b", "c", "d", "e"), start:=2) returns ("b", "c", "d", "e"). > > The expression fn:slice(("a", "b", "c", "d", "e"), start:=-2) returns ("d", "e"). > > The expression fn:slice(("a", "b", "c", "d", "e"), step:=2) returns ("a", "c", "e"). > > The expression fn:slice(("a", "b", "c", "d", "e"), start:=2, step:=2) returns ("b", "d"). > > The expression fn:slice(("a", "b", "c", "d", "e"), end:=3) returns ("a", "b", "c"). > > The expression fn:slice(("a", "b", "c", "d", "e"), start:=2, end:=3) returns ("b", "c"). > > The expression fn:slice(("a", "b", "c", "d", "e"), start:=2, length:=3) returns ("b", "c", "d"). > > The expression fn:slice(("a", "b", "c", "d", "e"), start:=-3, length:=2) returns ("c", "d"). > > The expression fn:slice(("a", "b", "c", "d", "e"), end:=-2) returns ("a", "b", "c", "d"). > > The expression fn:slice(("a", "b", "c", "d", "e"), at:=(1, 4, 5)) returns ("a", "d", "e"). > > The expression fn:slice(("a", "b", "c", "d", "e"), at:=(5, 4, 1)) returns ("a", "d", "e"). > > The expression fn:slice(("a", "b", "c", "d", "e"), at:=(1, -1)) returns ("a", "e"). > > The expression fn:slice(("a", "b", "c", "d", "e"), at:=(1 to 4) returns ("a", "b", "c", "d"). > > The expression fn:slice(("a", "b", "c", "d", "e"), from:=matches(?, "c")) returns ("c", "d", "e"). > > The expression fn:slice(("a", "b", "c", "d", "e"), after:=matches(?, "c")) returns ("d", "e"). > > The expression fn:slice(("a", "b", "c", "d", "e"), before:=matches(?, "c")) returns ("a", "b"). > > The expression fn:slice(("a", "b", "c", "d", "e"), until:=matches(?, "c")) returns ("a", "b", "c"). > > The expression fn:slice(("a", "b", "c", "d", "e"), start:=2, until:=matches(?, "c"))returns ("b", "c"). > > The expression fn:slice(("a", "b", "c", "d", "e"), from:=matches(?, "c"), until:=matches(?, "e")) returns ("c", "d", "e"). > > The expression fn:slice(("a", "b", "c", "d", "e"), start:=2, from:=matches(?, "a")) returns ("b", "c", "d", "e"). -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ.
Received on Thursday, 3 December 2020 10:33:17 UTC