Re: [xsl] check for whitespace value between nodes

Subject: Re: [xsl] check for whitespace value between nodes
From: Liam R E Quin <liam@xxxxxx>
Date: Thu, 19 Aug 2010 16:07:16 -0400
On Thu, 2010-08-19 at 12:58 -0500, a kusa wrote:
> Hi
> 
> Is there any way in XSLT to check if the value between two nodes is a
> whitespace?
> 
> I tried normalize-space(product/text()) !=' ' but that is not working.
> I want tocheck if the actual value between <product> </product> is a
> white space.

Whitespace is a tricky thing to get right. It's impossible to give you a
good answer without knowing more about what you are trying to do and
why, and the context, and without seeing your XSLT.

In some contexts, . eq ' ' would work, for example, and in others you
might want data(.) eq ' ' (both assuming XSLT 2) or even something like,
    matches(., '^\s+$')

Liam

Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
XML Blog: http://www.barefootliam.org/

Current Thread