This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE:
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE:
- From: "DuCharme, Robert" <Robert dot DuCharme at moodys dot com>
- Date: Wed, 17 May 2000 15:52:56 -0400
- Reply-To: xsl-list at mulberrytech dot com
><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