xsl-list
[Top] [All Lists]

Re: [xsl] check for whitespace value between nodes

2010-08-19 15:07:30
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/



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>