How to check if an apply-template filled variable is a string or (possibly) empty node in XSLT?
Posted
by calavera.info
on Stack Overflow
See other posts from Stack Overflow
or by calavera.info
Published on 2010-03-08T06:53:29Z
Indexed on
2010/03/08
7:21 UTC
Read the original article
Hit count: 390
xslt
I need a test which would evaluate to true in two cases:
- There is a string inside which contains any non white space characters
- There is any node (which can be possibly empty)
on a variable that is filled with apply-template call result.
I tried
test="normalize-space($var)"
but this doesn't cover the empty tag possibility. I also tried simply this:
test="$var"
but this evaluate to true even for white space only strings.
By the way "$var/*" produces an error "Expression ...something I don't remember... node-set" which is I think because of apply-template variable instantiation.
Is there any (which means even multi level decision) solution for this?
EDIT: I forgot to say that it's for XSLT 1.0 and preferably without any exslt extensions or similar.
© Stack Overflow or respective owner