• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XSL Problem

 
Shanmugam Muthukumarasamy
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have the following situation, in this if count(request) > 0 , I am showing the relevant details on the screen or if not, I have to show the message like " You have no file...." that. In the following xsl code:
if the condition is true, I am appliying the template "requests". This is working fine.
If the condigion is false, I am appliying the template "emptyrequest", this template is not at all showing to me...I am just getting the empty page.
If any one have the solution...Please let me know
Thanks in advance,
Shanmugam.

<xsl:when test="count(request)>0">
<xsl:apply-templates select="request"/>
</xsl:when>
<xsl therwise>
<xsl:apply-templates select="emptyrequest"/>
</xsl therwise>
</xsl:choose>
</xsl:element>
</td></tr></xsl:element>
</form>
</xsl:template>
<xsl:template match="request"><tr>
<td><p><xsl:element name="font">
<xsl:attribute name="face"><xsl:value-of select="$fontname"/></xsl:attribute>
<xsl:attribute name="size"><xsl:value-of select="$fontNormal"/></xsl:attribute>
<a href="javascript:showTransaction({@confirmationNumber})">
<xsl:value-of select="@confirmationNumber"/></a></xsl:element></p></td>
<td><p><xsl:element name="font">
<xsl:attribute name="face"><xsl:value-of select="$fontname"/></xsl:attribute>
<xsl:attribute name="size"><xsl:value-of select="$fontNormal"/></xsl:attribute>
<xsl:value-of select="type"/></xsl:element></p></td>
<td align="right"><p><xsl:element name="font">
<xsl:attribute name="face"><xsl:value-of select="$fontname"/></xsl:attribute>
<xsl:attribute name="size"><xsl:value-of select="$fontNormal"/></xsl:attribute>
<xsl:value-of select="datetime"/><xsl:text disable-output-escaping="yes">&nbsp;&nbsp;</xsl:text>
</xsl:element></p></td>
</tr></xsl:template>
<xsl:template match="emptyrequest">
<xsl:element name="table">
<xsl:attribute name="width">95%</xsl:attribute>
<xsl:attribute name="bgcolor"><xsl:value-of select="$tablebgcolor" /></xsl:attribute>
<xsl:attribute name="cellpadding">3</xsl:attribute>
<xsl:attribute name="cellspacing">0</xsl:attribute>
<xsl:attribute name="border">1</xsl:attribute>
<xsl:attribute name="bordercolor"><xsl:value-of select="$barcolor" /></xsl:attribute>
<tr><xsl:element name="td">
<xsl:attribute name="bgcolor"><xsl:value-of select="$barcolor" /></xsl:attribute>
<xsl:element name="font">
<xsl:attribute name="color"><xsl:value-of select="$headcolor" /></xsl:attribute>
<xsl:attribute name="size"><xsl:value-of select="$fontNormal"/></xsl:attribute>
<xsl:attribute name="face"><xsl:value-of select="$fontname"/></xsl:attribute>
<b>On-Line Requests</b>
</xsl:element>
</xsl:element>
</tr>
<tr><td>
<xsl:element name="table">
<xsl:attribute name="width">100%</xsl:attribute>
<xsl:attribute name="bgcolor"><xsl:value-of select="$tablebgcolor" /></xsl:attribute>
<xsl:attribute name="cellpadding">1</xsl:attribute>
<xsl:attribute name="cellspacing">0</xsl:attribute>
<xsl:attribute name="border">0</xsl:attribute>
<tr><td>
<p align="center">
<xsl:element name="font">
<xsl:attribute name="face"><xsl:value-of select="$fontname"/></xsl:attribute>
<xsl:attribute name="size"><xsl:value-of select="$fontNormal"/></xsl:attribute>
You have no On-Line Requests on file.
</xsl:element>
</p>
</td></tr>
</xsl:element>
</td></tr>
</xsl:element>
</xsl:template>
 
David Patterson
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure, but I'd start by making sure the test conditions are producing the logic you want.
Try using a message (xsl:message) to print the value of "count(request)" and "count(request) > 0". I'll bet that this is not working. If the result is always true, you would get the result you see.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic