[Mono-bugs] [Bug 67390][Nor] New - XslTransform generates extra newlines when inside TH tag

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 2 Oct 2004 14:48:43 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by mha@sollentuna.net.

http://bugzilla.ximian.com/show_bug.cgi?id=67390

--- shadow/67390	2004-10-02 14:48:43.000000000 -0400
+++ shadow/67390.tmp.6312	2004-10-02 14:48:43.000000000 -0400
@@ -0,0 +1,148 @@
+Bug#: 67390
+Product: Mono: Class Libraries
+Version: unspecified
+OS: GNU/Linux [Other]
+OS Details: Slackware linux 8.1, Mono 1.0.2
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.XML
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mha@sollentuna.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: XslTransform generates extra newlines when inside TH tag
+
+Description of Problem:
+
+When using XslTransform to generate HTML code in indented mode (<xsl:output
+indent="yes"/>), extra linebreaks are inserted inside <a> tags if they are
+inside a <th> tag.
+
+
+Steps to reproduce the problem:
+test.xml:
+--------
+<?xml version="1.0" encoding="iso-8859-1"?>
+<test/>
+
+test.xsl:
+--------
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <xsl:output method="html" version="4.01" indent="yes" />
+
+  <xsl:template match="/">
+    <html>
+      <body>
+        <table>
+          <tr>
+            <td>
+              X<a><xsl:attribute
+name="href">http://www.go-mono.com</xsl:attribute>CORRECT</a>X
+            </td>
+            <th>
+              Y<a><xsl:attribute
+name="href">http://www.go-mono.com</xsl:attribute>BROKEN</a>Y
+            </th>
+          </tr>
+        </table>
+
+      </body>
+    </html>
+  </xsl:template>
+</xsl:stylesheet>
+
+test.cs:
+using System;
+using System.IO;
+using System.Xml;
+using System.Xml.XPath;
+using System.Xml.Xsl;
+
+namespace test
+{
+  public class test
+  {
+    public static void Main()
+    {
+      XPathDocument xDoc = new XPathDocument("test.xml");
+
+      Stream str = File.Open("test.html",FileMode.Create);
+      StreamWriter writer = new
+StreamWriter(str,System.Text.Encoding.GetEncoding("ISO-8859-1"));
+
+      XslTransform transform = new XslTransform();
+      transform.Load("test.xsl");
+
+      transform.Transform(xDoc, null, writer, null);
+      writer.Close();
+      str.Close();
+    }
+
+  }
+
+Outputs incorrect data into test.html, per below.
+
+
+Actual Results:
+
+<html>
+  <body>
+    <table>
+      <tr>
+        <td>
+              X
+          <a href="http://www.go-mono.com">CORRECT</a>X
+
+        </td>
+        <th>
+              Y
+          <a href="http://www.go-mono.com">BROKEN
+          </a>Y
+            </th>
+      </tr>
+    </table>
+  </body>
+</html>
+
+
+Expected Results:
+
+<html>
+  <body>
+    <table>
+      <tr>
+        <td>
+              X
+          <a href="http://www.go-mono.com">CORRECT</a>X
+
+        </td>
+        <th>
+              Y
+          <a href="http://www.go-mono.com">BROKEN</a>Y
+            </th>
+      </tr>
+    </table>
+  </body>
+</html>
+
+
+How often does this happen? 
+
+Every time.
+
+
+Additional Information:
+
+Notice that an extra linebreak is added after the text BROKEN. Since thie
+is a <a> tag, this shows up in the browser as an extra space in the link,
+which looks like an "space with underline".
+It appears only to happen inside <th> and not <td>. The workaround is to
+use <td> with a couple of extra tags to make it look like it was a <th>,
+but it'd be better to be able to use <th>.
+(The linebreak before the <A> tag has no effect, but the one *inside* it is
+a problem.