Re: [xsl] tokenize function behaviour

Subject: Re: [xsl] tokenize function behaviour
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Fri, 03 Sep 2010 15:35:36 +0200
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/

Current Thread