W3C home > Mailing lists > Public > public-qt-comments@w3.org > August 2003

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

From: Jeni Tennison <jeni@jenitennison.com>
Date: Mon, 18 Aug 2003 22:25:08 +0100
Message-ID: <5740628375.20030818222508@jenitennison.com>
To: Tobias Reif <tobiasreif@pinkjuice.com>
CC: public-qt-comments@w3.org

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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:13 UTC