I wondered if that would come back to bite me. Eric, if you're curious where that's defined as an error (as I found myself moments ago), see err:FORX0003 under fn:tokenize in the F&O:
http://www.w3.org/TR/xquery-operators/#func-tokenize Aaron -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Mary Holstege Sent: Friday, February 13, 2009 4:11 PM To: General Mark Logic Developer Discussion Subject: Re: [MarkLogic Dev General] tokenize returns empty string on ""pattern On Fri, 13 Feb 2009 12:04:30 -0800, Eric Palmitesta <[email protected]> wrote: > declare variable $alphabet := tokenize('abcdefghijklmnopqrstuvwxyz', ''); > > for $x in $alphabet > return concat('[', $x, ']') > > <v:results v:warning="more than one node"> > [] [a] [b] [c] [d] [e] [f] [g] [h] [i] [j] [k] [l] [m] [n] [o] [p] [q] > [r] [s] [t] [u] [v] [w] [x] [y] [z] > </v:results> > > Why am I getting the empty string at the beginning of the sequence > returned from the above call to tokenize? Is this result expected? > > Eric Actually, the expected result is an error because the pattern matches the empty string and this is disallowed. If you used, say, " *" instead you would see the error. The reason you are getting that result (setting aside the bug that you shouldn't be getting any result at all) is that the empty pattern matches at every position including the first. Tokenize gives you every string separated by a matching instance of the pattern and stops when it gets to the end of the string. Since "" and "a" are separated by "", then you get the extra "". You don't get the extra "" at the end simply because the scan for matches has already stopped by that point. //Mary _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
_______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
