Re: [xsl] check for whitespace value between nodes

Subject: Re: [xsl] check for whitespace value between nodes
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Thu, 19 Aug 2010 21:44:06 +0100
On 19/08/2010 18:58, 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.


That space isn't between two nodes - it's between a begin tag and its corresponding end tag, and it is the child text node of the element represented by those tags.

If you want to test for a single space character, the test is

product = ' '

(where there's a single space between those apostrophes)

If you want to test for one or more whitespace characters, where whitespace characters include tab, CR, and NL, you could use matches(product, '\s+').

Michael Kay
Saxonica

Current Thread