Hi,
In my XML file, I have multiple 'Job' nodes. Within that node, there is an 'Award' item. Not every job has an 'Award' populated. :-(
When I output this in XSL, I would like to use an IF statement to only print the Award row if it's not blank. (I'd like to format this with a list item, and not have a list item display w/o any data by it.)
Can someone please point me in the direction of some tutorials/syntax help for this? I've seen a few snippets of code for checking for the position of an item, but not for if > 0.
Thanks!
Lisa
==== XML ====
<Job>
<Date_Worked>a</Date_Worked>
<Position_Title>b</Position_Title>
<Comp>
<Comp_Name>
<Comp_1>c</Comp_1>
<Comp_2>e</Comp_2>
</Comp_Name>
<Comp_City>Chicago</Comp_City>
<Comp_St>IL</Comp_St>
</Comp>
<Award>Employee of the Month</Award>
<Job_Desc>blah</Job_Desc>
</Job>
==== XSLT ====
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="Work_History">... .... .... .... <xsl:for-each select="Work_Exp/Job"> <tr> <td width="23%" colspan="2" valign="top" align="left"> <b><xsl:value-of select="Position_Title"/></b><br/> <xsl:value-of select="Date_Worked"/> </td> .... ....
....
<!-- NEED IF HERE -->
<tr><td width="100%" colspan="6" valign="top" align="left"> <xsl:value-of select="Award"/> </td> </tr>
</xsl:for-each>
In my XML file, I have multiple 'Job' nodes. Within that node, there is an 'Award' item. Not every job has an 'Award' populated. :-(
When I output this in XSL, I would like to use an IF statement to only print the Award row if it's not blank. (I'd like to format this with a list item, and not have a list item display w/o any data by it.)
Can someone please point me in the direction of some tutorials/syntax help for this? I've seen a few snippets of code for checking for the position of an item, but not for if > 0.
Thanks!
Lisa
==== XML ====
<Job>
<Date_Worked>a</Date_Worked>
<Position_Title>b</Position_Title>
<Comp>
<Comp_Name>
<Comp_1>c</Comp_1>
<Comp_2>e</Comp_2>
</Comp_Name>
<Comp_City>Chicago</Comp_City>
<Comp_St>IL</Comp_St>
</Comp>
<Award>Employee of the Month</Award>
<Job_Desc>blah</Job_Desc>
</Job>
==== XSLT ====
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="Work_History">... .... .... .... <xsl:for-each select="Work_Exp/Job"> <tr> <td width="23%" colspan="2" valign="top" align="left"> <b><xsl:value-of select="Position_Title"/></b><br/> <xsl:value-of select="Date_Worked"/> </td> .... ....
....
<!-- NEED IF HERE -->
<tr><td width="100%" colspan="6" valign="top" align="left"> <xsl:value-of select="Award"/> </td> </tr>
</xsl:for-each>