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

Problem with empty element check !

Subject: Problem with empty element check !
From: "Shamik Bandopadhyay -X \(sbandopa - TCS at Cisco\)" <sbandopa@xxxxxxxxx>
Date: Tue, 11 Jul 2006 03:03:13 +0530
xsl check for empty element

  I'm facing an issue with an empty element check using XSLT.Here's my
sample XSLT.I'm checking whether <money> has a value,id yes I'm
printing,else skip.But,even if there's no value or the tag doesn't
exist,the control is getting inside the xsl:if check and printing the
bullets.Any pointers will be appreciated. Here's the xsl I'm using.

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
	<xsl:template match="/">
				<h2>My CD Collection</h2>
				<table border="1">
					<tr bgcolor="#9acd32">
name="empty_string" select="money"/>
test="not($empty_string = normalize-space(.))">



<xsl:value-of select="money"/>



<xsl:value-of select="name()"/>

Here's the sample XML:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="catalog.xsl"?>
     <title>Empire Burlesque</title>
     <artist>Bob Dylan</artist>
     <title>Hide your heart</title>
     <artist>Bonnie Tyler</artist>
     <title>Greatest Hits</title>
     <artist>Dolly Parton</artist>
     <artist>John Denver</artist>


Current Thread


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.
First Name
Last Name
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.