This project is read-only.

Duplication in FirstNWords?

Nov 2, 2010 at 7:45 AM

While looking at the code for FirstNWords, I saw that for the two "xsl:when"s there is some duplicate check:

<xsl:when test="$WordCount &gt; 1 and (string-length(substring-before($TextData, ' ')) &gt; 0 or string-length(substring-before($TextData, ' ')) &gt; 0)">
<xsl:when test="(string-length(substring-before($TextData, ' ')) &gt; 0 or string-length(substring-before($TextData, ' ')) &gt; 0)">

Is this an error or is there a special reason for this?

Nov 2, 2010 at 12:36 PM

It's hard to see, but the first is a check for one space and the second is a check for two spaces. I found that there were frequently two spaces at the end of sentences, so this helps with that. Make sense?


Nov 2, 2010 at 1:29 PM

I see, thanks for the clarification. I assumed so at first, but looking at the file I could only see a single space each time. Just checked again in Notepad++ and in Visual Studio, I can still see a single space only.

Nov 2, 2010 at 1:58 PM

Right you are. I just updated it and added a new release. I must have lost those spaces in a copy and paste somewhere. Thanks for pointing it out!