View Single Post
  #1 (permalink)  
Old June 6th, 2006, 08:52 AM
deltree deltree is offline
Registered User
 
Join Date: Jun 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default If Then Statements in XSL

I have a question about if then statements in XSLT. I would like to display a line of code only if a specific data item is not null. It seems to be a bit of a daunting task for me, an XML/XSL n00b, but I'm hoping that some of the experts here will know just the trick.

Explanation below:

I curently have links setup like the following:

<a href="/express/index.cgi?add_by_express={$prod},{$unit},1">Read More</a><br/>

Where unit is defined as:

<xsl:variable name="unit">
<xsl:value-of select="Selling_UM_1"/>
</xsl:variable>

However, there are multiple instances where the value of Selling_UM_1 is empty in the XML. In these instances, I would like the link to not show, The link should only show up when Selling_UM_1 is populated. So I'm thinking something like:

If Selling_UM_1 != null {
Display <a href="/express/index.cgi?add_by_express={$prod},{$unit},1"> Read More</a><br/>
}

Else {
Display &nbsp;
}


I just don't know how to turn that into XSL.

Could anyone offer some suggestions?

Thanks

Reply With Quote