Re: Re: [xsl] Create word elements from a string

Subject: Re: Re: [xsl] Create word elements from a string
From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx>
Date: Thu, 29 Oct 2009 14:14:23 +0530
On Thu, Oct 29, 2009 at 12:28 PM, Larry Hayashi <lhtrees@xxxxxxxxx> wrote:
> I did run into a problem with:
> <xsl:when test="contains($str, ' ')">
> The test always returns true even when I only have one word in the
> text. I don't particularly understand why, but when I change it to
> this, everything works fine:
> <xsl:when test="contains(normalize-space($str), ' ')">

Did you run this modified syntax, with the same input you specified
earlier (i.e, <text>Jill ran up the hill.</text>)?
If your input was this (i.e, text node within <text> as mentioned
above), then I think normalize-space is not needed.

> Why does it return true when normalize-space is not there? I would
> think with only one word, there wouldn't be any spaces.

If you can post the input with which, you ran your stylesheet it would
be helpful to find an answer to your question. It would also be
helpful, if you mention the XSLT engine you are using.

Mukul Gandhi

Current Thread