[xquery-talk] string manipulation
Michael Kay
mhk at mhk.me.uk
Sun Feb 5 22:50:51 PST 2006
>
> In order to do what you want, you will need to use "fn:subsequence()":
>
> string-join(subsequence(tokenize("book/title/author", "/"), 1, last() -
1), "/")
No, there's nothing here that changes the context, so the value of last() is
unrelated to the number of tokens returned by tokenize().
>
> Instead of that, you could also try:
>
> replace("book/title/author", "/.*?$", "")
>
No, the "/" here will match the first "/" in the expression.
>
> let $str := "book/title/author" return
> substring-before($str, concat("/", substring-after($str, "/")))
>
No, this will return "book".
> I'm sure there are other good ways to acheive the result you want.
There are indeed.
Michael Kay
http://www.saxonica.com/
More information about the talk
mailing list