[Mono-bugs] [Bug 450797] New: XslCompiledTransform doesn't preserve xsl: text containing only whitespace

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Dec 2 04:10:26 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=450797


           Summary: XslCompiledTransform doesn't preserve xsl:text
                    containing only whitespace
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: jonathan.l.anderson at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


If you Load a Xsl transform via XslCompiledTransform.Load using one of the
XmlReader overloads, xsl:text elements that contain only whitespace do not
cause the whitespace to appear in the output.  XslTransform does not have this
problem.

I'll be attaching a proposed patch with a test case included.  All I changed
was to have XslCompiledTransform.Load create the XPathDocument with the
XmlSpace.Preserve tag in the same way that XslTransform.Load does.  Here's a
test (which will also be in the patch file):

[Test]
public void XslTextElement_PreservesWhitespace ()
{
        XslCompiledTransform xslt = new XslCompiledTransform ();
        xslt.Load (new XmlTextReader (new StringReader (@"
<xsl:stylesheet
  xmlns:xsl=""http://www.w3.org/1999/XSL/Transform""
  version=""1.0"">
  <xsl:output method='text' omit-xml-declaration='yes'/>
  <xsl:template match='foo'>
    <xsl:text> </xsl:text>
  </xsl:template>
</xsl:stylesheet>")));
        StringWriter sw = new StringWriter ();
        xslt.Transform (new XmlTextReader (new StringReader
(@"<foo>bar</foo>")), null, sw);
        Assert.AreEqual (" ", sw.ToString ());
}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list