This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Skip Nodes If Condition


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]