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

Re: How to check for absence of a node?

Subject: Re: How to check for absence of a node?
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Fri, 15 Jun 2001 16:15:27 +0100
rene tennison
Hi Sudhir,

> I would like to call error-template in case
>
> A. I don't find the node "format/tr[2]/td[position()>1]", or

The test here is just:

  not(format/tr[2]/td[position() > 1])

> B. The value of format/tr[2]/td[position()>1] is "NA"

>From your code, I think you want to know if *all* the tds following
the first are equal to 'NA'. You have to turn the XPath around to make
that test - you want to know if it's *not* the case that *at least
one* of the tds is *not equal to* 'NA':

  not(format/tr[2]/td[position() > 1] != 'NA')

So the XSLT should be:

  <xsl:variable name="cells"
                select="format/tr[2]/td[position() > 1]"  />
  <xsl:choose>
     <xsl:when test="not($cells) or
                     not($cells != 'NA')">
        <xsl:call-template name="error-template" />
     </xsl:when>
     <xsl:otherwise>
        <xsl:apply-templates select="format" />
     </xsl:otherwise>
  </xsl:choose>

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.