xsl-list
[Top] [All Lists]

Re: test if null

2005-06-28 17:42:18
Hi Jay,

The solution that David Carlisle gave you first works. If you did not
get it to work, you should rather ask yourself (or the list) why it
didn't work for you.

What we where discussing was not checking whether <sample> element was
present but whether it had a text() child. That is, the scope was
within the <sample> element.

In this scope, using DC's solution is the most efficient way of
solving your problem.

In short:
<xsl:if test="*">....</xsl:if>
does not distinguish between <sample/> and <sample>some text</sample>

<xsl:if test="string-length(.)=0">....</xsl:if>
does not distinguish between <sample/> and <sample><sub/></sample>

<xsl:if test="node()">....</xsl:if>
does distinguish between <sample/> and all variations of <sample>....</sample>

I hope that you can see the difference.

Regards,
Ragulf Pickaxe :-)


On 6/28/05, -= jay =- <deepsweech(_at_)gmail(_dot_)com> wrote:
Hi Ragulf,
The node is always present, but im checking if it returns empty string or not
like:
<sample /> -->this is empty
<sample>not empty</sample>  ->not empty

thanks guys!

--~------------------------------------------------------------------
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>