whitespace in XSLT transformation

I've got a table that includes an XML control on an ASP.NET page.  The XML control has an XSLT transformation that returns some values from my XML file.  It does exactly what I want to do in terms of returning the right values from the XML, but the whitespace on the table is bothering me.  I'm not sure if its the way I designed the table or the way the XSLT file is transforming.  Can somebody help? I've attached a screenshot as well as the markup and XSLT file.  


<table border="0" width="1000px"  ><tr><td width="50px"></td>
    <td width="900px" style="border-color : #000000; background-color:#3399FF;" 
        align="left">
       
    <asp:Xml ID="Xml1" runat="server" DocumentSource="~/News.xml" 
            TransformSource="~/Newone.xslt"></asp:Xml></td><td width="50px"></td></tr></table> 
 
 
xslt file
 
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:strip-space elements="*"/>
  <xsl:template match="Message[Message]">
    <xsl:variable name="no-of-mess">
      <xsl:value-of select="count(Message)"/>
    </xsl:variable>
    <html>
      <body>
 
 
        <table border="0">
         
          <xsl:apply-templates select="Message[position() > ($no-of-mess - 3) ]"/>
        </table>
      </body>
    </html>
  </xsl:template>
  <xsl:template match="Message[parent::Message]">
    <tr>
      <td style="color:red; font-weight:bold">
 
        <xsl:value-of select="date"/>
 
      </td>
    </tr>
    <tr>
 
      <td style ="font-weight:bold">
        <xsl:value-of select="messagetext"/>
        <br/>
        <br/>
      </td>
    </tr>
    <br/>
    <br/>
  </xsl:template>
</xsl:stylesheet>

Open in new window

screenshot010.jpg
JeffEaeAsked:
Who is Participating?
 
aibusinesssolutionsConnect With a Mentor Commented:
I played around with it and found the problem.  At the bottom of your XSLT file you have this.

      <td style ="font-weight:bold">
        <xsl:value-of select="messagetext"/>
        <br/>
        <br/>
      </td>
    </tr>
    <br/>
    <br/>
  </xsl:template>
</xsl:stylesheet>

Remove the two <br/>'s at the bottom, they are outside of the <td> so they go outside of the table cells.
0
 
aibusinesssolutionsCommented:
Have you tried removing the whitespace from your xslt file?

What does the source code of your page look like when you view the source?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.