[xquery-talk] string manipulation

Marc Van Cappellen Marc.Van.Cappellen at datadirect.com
Sun Feb 5 16:29:15 PST 2006


Ryan,

if you want to use a predicate to strip the last item out of a sequence,
do [position() < last()]

Marc

> -----Original Message-----
> From: talk-bounces at xquery.com [mailto:talk-bounces at xquery.com] On
Behalf
> 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,
since
> >> the predicate only selects the node at the numeric position when
given
> >> an expression that returns a /single/ numeric value. "1 to last() -
1"
> >> will return a sequence of numeric values.
> >
> > The behavior you are describing for the expression "1 to last() - 1"
is
> > exactly what I was looking for.  Putting this type of expression
inside
> > of a predicate is something that I make heavy use of.  However, it
> > appears that it is something that not all xquery engines support.
Doing
> > this works perfectly well in Mark Logic but I just tested it using
Saxon
> > and it does not work there.
> > I checked out the spec and I can't find mention of this feature
being
> > 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
talking
> 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
> 
> --
> John Snelson, Berkeley DB XML Engineer
> Sleepycat Software, Inc
> http://www.sleepycat.com
> 
> Contracted to Sleepycat through Parthenon Computing Ltd
> http://blog.parthcomp.com/dbxml
> _______________________________________________
> talk at xquery.com
> http://xquery.com/mailman/listinfo/talk



More information about the talk mailing list