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

RE: Newbie: See if a node exists!

Subject: RE: Newbie: See if a node exists!
From: Anand Kuppa <AnandK@xxxxxxxxxxxxxx>
Date: Fri, 7 Jun 2002 14:24:18 +0100
xsl if node exists
thanks for all the info, guys... i am just starting out in XSL and these
were real good tips....

-----Original Message-----
From: Joerg Heinicke [mailto:joerg.heinicke@xxxxxx]
Sent: Friday, June 07, 2002 2:36 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  Newbie: See if a node exists!


Anand Kuppa wrote:
> Try using COUNT
> you could do something like 
> 
> <xsl:when test = "if COUNT(BLOCK) > 0>
> 	........what u want to do 
> </xsl:when>
> 
> lemme know if it worked...
> cheers

Hello Anand,

you never need to count elements, if you only want to know, whether an 
element exists or not.

<xsl:if test="BLOCK">
</xsl:if>

is enough.

Even if you want to know whether there are 4 elements or not, you don't need

to count them:

<xsl:if test="BLOCK[4]">
</xsl:if>

tests whether a 4th BLOCK-element does exist.

Your test as above has two little errors:

<xsl:when test="count(BLOCK) > 0">
</xsl:when>

There must not be an 'if' in the test. The element already has the name 
<xsl:if/> or <xsl:when/>. And - as David wrote - XML is case sensitive, so 
their is no XPATH function COUNT(), but count().

Regards,

Joerg


-- 

System Development
VIRBUS AG
Fon  +49(0)341-979-7419
Fax  +49(0)341-979-7409
joerg.heinicke@xxxxxxxxx
www.virbus.de


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

 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.