cfbeginner
MIS
HI Everyone,
I'm trying not to display one category item from the table, specifically 'News' category. How do I go about coding this in my XSL file. Here is the XML code(partial):
<category catid="4" selected="0" name="News " description="News related to application development"><subcategory subcatid="63" selected="0"><name>News </name><company> </company><isHotLink>1</isHotLink><nDocs>39</nDocs></subcategory></category>
Here is the XSL code:
<xsl:stylesheet version="1.0"
xmlns:xsl=' <xsl
utput method='html'/>
<xsl:template match="root">
<xsl:variable name="count" select="1"/>
<table cellspacing="0" WIDTH="100%">
<tr>
<xsl:apply-templates select="category[1]" />
<xsl:apply-templates select="category[2]" />
<xsl:apply-templates select="category[3]" />
</tr>
<tr/><tr/><tr/><tr/><tr/><tr/>
<tr><td width="25%" valign="top">
<xsl:apply-templates select="category[1]/subcategory" />
</td>
<td width="5%"></td>
<td width="25%" valign="top">
<xsl:apply-templates select="category[2]/subcategory" /></td>
<td width="5%"></td>
<td valign="top" width="25%">
<xsl:apply-templates select="category[3]/subcategory" /></td>
</tr>
<tr/><tr/><tr/><tr/><tr/><tr/>
<tr>
<xsl:apply-templates select=" category[4]" />
<xsl:apply-templates select=" category[5]" />
<xsl:apply-templates select=" category[6]" />
</tr>
<tr>
<td valign="top" width="25%">
<xsl:apply-templates select="category[4]/subcategory" /> </td>
<td width="5%"></td>
<td valign="top" width="25%">
<xsl:apply-templates select="category[5]/subcategory" />
</td>
<td width="5%"></td>
<td valign="top" width="25%">
<xsl:apply-templates select="category[6]/subcategory" /> </td>
</tr>
<tr>
<td colspan="5" valign="top" align="right" >
<br/><br/>
<a>
<xsl:attribute name="href">Category.asp?CatID=0</xsl:attribute>
more categories...
</a>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="category">
<a>
<xsl:attribute name="href">Category.asp?CatID=<xsl:value-of select="normalize-space(@catid)"/>&Catname=<xsl:value-of select="normalize-space(@name)"/></xsl:attribute>
<td width="25%" class="Category" bgcolor="333366" onMouseOut="this.bgColor='333366';return true;"
onMouseOver="this.bgColor='FF9900';this.style.cursor='hand';">
<xsl:attribute name="title"><xsl:value-of select="@description" /></xsl:attribute>
<xsl:value-of select="@name" />
</td>
</a>
<td width="5%"></td>
</xsl:template>
<xsl:template match="subcategory">
<xsl:if test="(position() < 5)">
<a>
<xsl:attribute name="href">Subcategory.asp?SubCatID=<xsl:value-of select="normalize-space(@subcatid)"/></xsl:attribute>
<xsl:value-of select="name" /></a>
<xsl:if test="(position() < 4)">
<xsl:if test="not(position()=last())">, </xsl:if>
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Thanks for all your help!!!
I'm trying not to display one category item from the table, specifically 'News' category. How do I go about coding this in my XSL file. Here is the XML code(partial):
<category catid="4" selected="0" name="News " description="News related to application development"><subcategory subcatid="63" selected="0"><name>News </name><company> </company><isHotLink>1</isHotLink><nDocs>39</nDocs></subcategory></category>
Here is the XSL code:
<xsl:stylesheet version="1.0"
xmlns:xsl=' <xsl
<xsl:template match="root">
<xsl:variable name="count" select="1"/>
<table cellspacing="0" WIDTH="100%">
<tr>
<xsl:apply-templates select="category[1]" />
<xsl:apply-templates select="category[2]" />
<xsl:apply-templates select="category[3]" />
</tr>
<tr/><tr/><tr/><tr/><tr/><tr/>
<tr><td width="25%" valign="top">
<xsl:apply-templates select="category[1]/subcategory" />
</td>
<td width="5%"></td>
<td width="25%" valign="top">
<xsl:apply-templates select="category[2]/subcategory" /></td>
<td width="5%"></td>
<td valign="top" width="25%">
<xsl:apply-templates select="category[3]/subcategory" /></td>
</tr>
<tr/><tr/><tr/><tr/><tr/><tr/>
<tr>
<xsl:apply-templates select=" category[4]" />
<xsl:apply-templates select=" category[5]" />
<xsl:apply-templates select=" category[6]" />
</tr>
<tr>
<td valign="top" width="25%">
<xsl:apply-templates select="category[4]/subcategory" /> </td>
<td width="5%"></td>
<td valign="top" width="25%">
<xsl:apply-templates select="category[5]/subcategory" />
</td>
<td width="5%"></td>
<td valign="top" width="25%">
<xsl:apply-templates select="category[6]/subcategory" /> </td>
</tr>
<tr>
<td colspan="5" valign="top" align="right" >
<br/><br/>
<a>
<xsl:attribute name="href">Category.asp?CatID=0</xsl:attribute>
more categories...
</a>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="category">
<a>
<xsl:attribute name="href">Category.asp?CatID=<xsl:value-of select="normalize-space(@catid)"/>&Catname=<xsl:value-of select="normalize-space(@name)"/></xsl:attribute>
<td width="25%" class="Category" bgcolor="333366" onMouseOut="this.bgColor='333366';return true;"
onMouseOver="this.bgColor='FF9900';this.style.cursor='hand';">
<xsl:attribute name="title"><xsl:value-of select="@description" /></xsl:attribute>
<xsl:value-of select="@name" />
</td>
</a>
<td width="5%"></td>
</xsl:template>
<xsl:template match="subcategory">
<xsl:if test="(position() < 5)">
<a>
<xsl:attribute name="href">Subcategory.asp?SubCatID=<xsl:value-of select="normalize-space(@subcatid)"/></xsl:attribute>
<xsl:value-of select="name" /></a>
<xsl:if test="(position() < 4)">
<xsl:if test="not(position()=last())">, </xsl:if>
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Thanks for all your help!!!