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

RE: Using xsl:if to determine if a node is empty.

Subject: RE: Using xsl:if to determine if a node is empty.
From: "Diamond, Jason" <Jason.Diamond@xxxxxxx>
Date: Fri, 15 Sep 2000 13:28:27 -0500
using xsl if
This is what I usually use to determine if an element is "empty" or not:

<xsl:if test="string-length(normalize-space(.)) &gt; 0">
  ...
</xsl:if>

It works but I'd like a more "elegant" solution if someone else has one.

Jason Diamond.

-----Original Message-----
From: Roger Flory [mailto:rflory@xxxxxxxxxxxx]
Sent: Friday, September 15, 2000 07:44
To: 'XSL-List@xxxxxxxxxxxxxxxx'
Subject: Using xsl:if to determine if a node is empty.


I am fairly new to XML/XSL.  In fact I am writing my first XSL for a
production environment.  I am trying to determine if a node is empty so that
I can print a line or not.  I have tried several different variations of
template matching and xsl:if statements and have not been able to get
anywhere.  

Here is the latest thing that I have tried which seems to match evertime
through so the text is coming out even on empty tags.

<xsl:template match="VENDOR_ITEM_NUM">	
	<xsl:variable name="empty_tag"></xsl:variable>
	<tr>
		<td></td>
		<td>
			<font size="2">
			<xsl:if test="$empty_tag != .">
			<xsl:value-of select="concat('Vendor Item number:
',.)"/>
			</xsl:if>
			</font>
		</td>
	</tr>
</xsl:template>

Any help would be greatly appreciated.



 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.