[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: test if null

Subject: Re: test if null
From: Ragulf Pickaxe <ragulf.pickaxe@xxxxxxxxx>
Date: Wed, 29 Jun 2005 02:42:18 +0200
xsl test if null
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@xxxxxxxxx> 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!

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.