[Bug 29752] [XSLT30]two accumulator examples using count(tokenize(., '\s+')) respectively count(tokenize(., '\W+')) to count words give odd results

https://www.w3.org/Bugs/Public/show_bug.cgi?id=29752

--- Comment #2 from Martin Honnen <martin.honnen@gmx.de> ---
(In reply to Michael Kay from comment #1)

> I'm inclined though to use the new XPath 3.1 tokenize#1
> 
> <xsl:accumulator-rule match="text()" 
>          select="$value + count(tokenize(.))"/>
> 
> which gives the correct answer 14 (whether or not we strip whitespace text
> nodes) without making the example a lot more complicated.


That looks much better than the previous approaches using tokenize(., '\W+'). 

It is still easily possible to construct input samples like

<p>He asked:"Does it work?"</p>

where the analyze-string count on \w+ sequences would work better but I agree
the examples on accumulators need to be short to demonstrate the use of
accumulators and not to present more complicated attempts on word counting.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Friday, 30 September 2016 11:47:44 UTC