Re: [xslt2 func/op] tokenizing "abba" to ("a","b","b","a")

Hi Tobi,

> I need to get a sequence of the characters in a string.
>
> The current draft
>   http://www.w3.org/TR/xquery-operators/#func-tokenize
> says
>   'fn:tokenize("abba", ".?") returns ("a", "b", "b", "a")'
>
> I don't understand why it should.

The definition of the fn:tokenize() function says:

 "If the supplied $pattern matches a zero-length string, the
  fn:tokenize() function breaks the string into its component
  characters. The nth character in the $input string becomes the nth
  string in the result sequence; each string in the result sequence
  has a string length of one."

In the example above, the pattern ".?" is a pattern that matches a
zero-length string; therefore, the fn:tokenize() function breaks the
string into its component characters. You would get the same behaviour
from any pattern that matches a zero-length string, such as "" or
".*".

Does that explain the example sufficiently?

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Monday, 18 August 2003 17:25:07 UTC