[xquery-talk] string manipulation
Marc Van Cappellen
Marc.Van.Cappellen at datadirect.com
Sun Feb 5 16:29:15 PST 2006
if you want to use a predicate to strip the last item out of a sequence,
do [position() < last()]
> -----Original Message-----
> From: talk-bounces at xquery.com [mailto:talk-bounces at xquery.com] On
> Of John Snelson
> Sent: Sunday, February 05, 2006 9:22 PM
> To: Ryan Grimm
> Cc: fatma helmy; talk at xquery.com
> Subject: Re: [xquery-talk] string manipulation
> Ryan Grimm wrote:
> >> Unfortunatley, the predicate "[1 to last() - 1]" will not work,
> >> the predicate only selects the node at the numeric position when
> >> an expression that returns a /single/ numeric value. "1 to last() -
> >> will return a sequence of numeric values.
> > The behavior you are describing for the expression "1 to last() - 1"
> > exactly what I was looking for. Putting this type of expression
> > of a predicate is something that I make heavy use of. However, it
> > appears that it is something that not all xquery engines support.
> > this works perfectly well in Mark Logic but I just tested it using
> > and it does not work there.
> > I checked out the spec and I can't find mention of this feature
> > present but it makes for a very handy short form of subsequence().
> The Mark Logic XQuery engine implements the May 2003 Working Draft of
> XQuery, and a lot has changed since then. The expression we are
> about is one of the things that has changed - the other XQuery engines
> you talk about seem to be specification complient in this respect.
> John Snelson, Berkeley DB XML Engineer
> Sleepycat Software, Inc
> Contracted to Sleepycat through Parthenon Computing Ltd
> talk at xquery.com
More information about the talk