This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Skip Nodes If Condition
- From: "Scott Purcell" <spurcell at vertisinc dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Tue, 25 Jun 2002 16:10:28 -0500
- Subject: [xsl] Skip Nodes If Condition
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hello,
I am trying to skip certain nodes if a condition is met.
I have searched the mailing list, but cannot find a good match for my problem.
If the ad_content does NOT contain a label, I want to skip it. Is it best to do a "if test" like I did below, or is there a better technique that I need to learn?
Thanks
Scott
Here is a piece of the xml:
<ad_content>
<item_type>hidden</item_type>
</ad_content>
<ad_content>
<label>headline</label>
<item_type>hidden</item_type>
</ad_content>
I am sending this to a template match. eg:
<xsl:apply-templates select="ad/ad_content" />
<!-- template -->
<xsl:template match="ad_content">
<h3>ad_content</h3>
<xsl:if test="label[.!='']"> <!-- make sure it is not blank -->
<xsl:value-of select="label" />
</xsl:if>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list