ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> visual-xslt-discuss
visual-xslt-discuss
Re: [Visual-XSLT-discuss] VisualXSLT generates unicode when debugging
by Michael Holdsworth other posts by this author
Aug 21 2002 2:20PM messages near this date
view in the new Beta List Site
[Visual-XSLT-discuss] VisualXSLT generates unicode when debugging | Re: [Visual-XSLT-discuss] VisualXSLT generates unicode when debugging
Christian,

This is clearly a bug in the product.

One of the quirks of Microsoft's XML parser (which appears to be what is
being used) is that the encoding attribute is ignored if the output is
transformed in code to a string. The XML parser only honors the encoding
attribute if the transform is performed where the output is an object of
the type that supports either an ISTREAM interface or a XMLDOMDocument
interface. These are the interfaces for the MSXML3 and MSXML4 parsers (off
the top of my head I don't know what interfaces are supported by the
system.xml classes (although from the Visual XSLT documentation it would
appear that the .NET XML classes are not used).

The reason that I am pretty certain that the above explaination is accurate
is that I ran into a similar problem with some ASP code I have where I pull
data from a database and transform it into HTML. It all worked when I used
the IXSLProcessor interface and set the output property to the ASP response
object. To improve performance we decided to start caching the generated
HTML in a database and this is when things started going wrong (we were
retrieving a string). The workaround I used was to set the output property
to an ADO stream (which supported the ISTREAM interface), I then rewound
the ADO stream and read it and it gave me what I wanted.

I have found one of the most interesting aspects of programming is to try
and figure our kludges to get around unexpected behaviour (of course
sometimes it pays to read the documentation).

If I were you I would report this to ActiveState as a bug. It should be
easy for them to fix (you can always get them to contact me if they need
help fixing it).

This bug fix won't help me since I'm not sure whether my license covers
upgrades.

Thanks
Mike Holdsworth


|---------+--------------------------------------------------> 
|         |           Christian Riesch                       |
|         |           <christian.riesch@[...].at>           |
|         |           Sent by:                               |
|         |           visual-xslt-discuss-admin@listserv.Acti|
|         |           veState.com                            |
|         |                                                  |
|         |                                                  |
|         |           08/21/2002 04:08 AM                    |
|         |                                                  |
|---------+--------------------------------------------------> 
  > -----------------------------------------------------------------------------------------
-----|
  |                                                                                         
     |
  |       To:       "'visual-xslt-discuss@listserv.ActiveState.com'"                        
     |
  |        <visual-xslt-discuss@[...].com>                                         |
  |       cc:                                                                               
     |
  |       Subject:  [Visual-XSLT-discuss] VisualXSLT generates unicode when debugging       
     |
  > -----------------------------------------------------------------------------------------
-----|




Hi,

While writing XSLT stylesheets to generate plain text files from XML source
I noticed that Visual XSLT  generated unicode output (in debug mode)
although I set ISO-8859-1 in xslt:output.

XSLT:
<?xml version="1.0"?> 
<xslt:stylesheet xmlns:xslt="http://www.w3.org/1999/XSL/Transform" version
="1.0"> 
             <xslt:output method="text" encoding="ISO-8859-1"/> 
</xslt:stylesheet> 

input file:
<?xml version="1.0"?> 
<a> Hello World</a>

output (in binary editor):
FF FE 48 00 65 00 6C 00 6C 00 6F 00 20 00 57 00  ..H.e.l.l.o. .W.
6F 00 72 00 6C 00 64 00                          o.r.l.d.


If I run the XSLT via Debug-> "Start without debugging" it produces
non-unicode as expected.

Is there a possibility to change this behaviour?

Thanks,
Christian


***************************************************************************
Christian Riesch (Mr.), Software Development
OMICRON electronics GmbH, Oberes Ried 1, A-6833 Klaus / Austria
Tel.: +43 5523 507 0, Fax.: +43 5523 507 999
http://www.omicron.at/      christian.riesch AT_NOSPAM omicron.at
***************************************************************************


_______________________________________________
Visual-XSLT-discuss mailing list
Visual-XSLT-discuss@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs





_______________________________________________
Visual-XSLT-discuss mailing list
Visual-XSLT-discuss@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Michael Holdsworth
Eric Promislow

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved