Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: .NET security update broke transform engine?

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 7/14/2007 4:22:00 PM

APA wrote:
> I didn't say I was using the XslTransform class, I was generically 
> referring to the XslTransform engine in .NET (and this is a .NET 2.0 
> application).  The issue is clearly a problem with the update as my 
> server that does not have the update doesn't produce the bad output but 
> the one with it does.
> 
> Here's a real simple example that produces the bad output.
> 
> 
>         <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>             <xsl:output method="html" omit-xml-declaration="no"  
> encoding="ISO-8859-1" />
> 
>             <xsl:template match="/">
>                 <b>&#0160;</b>
>             </xsl:template>
> 
>         </xsl:stylesheet>
> 
> 
> This generates character xFFFD in the output where it produced a proper 
> space character previously.

I have a Windows XP system here that on Wednesday got the security 
update for KB928365. Using your stylesheet I made the following complete 
test case

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Xml;
using System.Xml.Xsl;

namespace ConsoleApplication106
{
     class Program
     {
         static void Main(string[] args)
         {
             XslCompiledTransform xsltProcessor = new 
XslCompiledTransform();
             xsltProcessor.Load(XmlReader.Create(new 
StringReader(@"<xsl:stylesheet 
xmlns:xsl=""http://www.w3.org/1999/XSL/Transform"" version=""1.0"">
<xsl:output method=""html"" indent=""no"" encoding=""ISO-8859-1""/>
<xsl:template match=""/""><b>&#160;</b></xsl:template>
</xsl:stylesheet>")));
             MemoryStream memStream = new MemoryStream();
             xsltProcessor.Transform(XmlReader.Create(new 
StringReader(@"<dummy/>")), null, memStream);
             memStream.Position = 0;
             StreamReader streamReader = new StreamReader(memStream, 
xsltProcessor.OutputSettings.Encoding);
             string contents = streamReader.ReadToEnd();
             streamReader.Close();
             foreach (char c in contents)
             {
                 Console.WriteLine("Character '{0}' with codepoint 
{1}.", c, (int)c);
             }
         }
     }
}

The output on the console is

Character '<' with codepoint 60.
Character 'b' with codepoint 98.
Character '>' with codepoint 62.
Character ' ' with codepoint 160.
Character '<' with codepoint 60.
Character '/' with codepoint 47.
Character 'b' with codepoint 98.
Character '>' with codepoint 62.

so the non-breaking space (character 160) is correctly included in the 
output.

I can't reproduce the problem you describe.


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent