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

RE:

Subject: RE:
From: "DuCharme, Robert" <Robert.DuCharme@xxxxxxxxxx>
Date: Wed, 17 May 2000 15:52:56 -0400
empty a element
><DEPOSIT>
>  <A>fixedDeposit</A>
>  <B>RecurringDeposit</B>
></DEPOSIT>
>
>In the above mentioned case, some times the value of
>either A or B will be null, but while i extract the
>info through stylesheet, i have to check for the
>element which has null and i must not print it.

Here's one way that only copies the element if its contents is not equal to
an empty string:

  <xsl:template match="A|B">
    <xsl:if test=". !=''">
      <xsl:copy><xsl:apply-templates/></xsl:copy>
    </xsl:if>
  </xsl:template>                     

I'm sure there are other approaches. This way assumes that an empty A
element is represented as <A></A> or as <A/>. Potential whitespace will
complicate the situation. 

Also, keep in mind that with schemas, real null values (as opposed to empty
elements) will be possible.

Bob DuCharme          www.snee.com/bob           <bob@  
snee.com>  "The elements be kind to thee, and make thy
spirits all of comfort!" Anthony and Cleopatra, III ii


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


Current Thread
  • RE:
    • DuCharme, Robert - Wed, 17 May 2000 15:52:56 -0400 <=

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.