xsl-list
[Top] [All Lists]

Re: [xsl] tokenize function behaviour

2010-09-03 08:35:54
Bartolomeo Nicolotti wrote:

could you please confirm that

count(tokenize( @Attribute,';'))

returns:

0 if Attribute=""
2 if Attribute=";"

Looking at http://www.w3.org/TR/xpath-functions/#func-tokenize it clearly says

"If $input is the empty sequence, or if $input is the zero-length string, the result is the empty sequence."

so yes, count(tokenize('', ';')) is 0.

And it also says

"If a separator occurs at the start of the $input string, the result sequence will start with a zero-length string. Zero-length strings will also occur in the result sequence if a separator occurs at the end of the $input string, or if two adjacent substrings match the supplied $pattern."

so you get 2 for count(tokenize(';', ';'))

--

        Martin Honnen
        http://msmvps.com/blogs/martin_honnen/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>