xsl-list
[Top] [All Lists]

RE: [xsl] using xsl:message with UTF-8 characters

2007-04-20 16:24:05
Take this stylesheet:

<xsl:template name="main">
  <xsl:value-of select="'V: &#xaa;&#xba;&#x20ac;'"/>
  <xsl:message>M: &#xaa;&#xba;&#x20ac;</xsl:message>
</xsl:template> 

If I run it from the command prompt in UltraEdit under WinXP, the message
(M:) displays correctly and the principal output (V:) does not.

If I run it from the command console (obtained using "cmd") both outputs are
garbage.

So it all depends on the environment; I'm afraid there's not much I can do
about that.

Michael Kay
http://www.saxonica.com/
 

-----Original Message-----
From: Manfred Staudinger 
[mailto:manfred(_dot_)staudinger(_at_)gmail(_dot_)com] 
Sent: 20 April 2007 23:22
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] using xsl:message with UTF-8 characters

On 20/04/07, Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:
By default the output from xsl:message in Saxon goes to System.err, 
and the handling of special characters therefore depends 
partly on the 
Java IO library and partly on the operating system (perhaps even on 
which command shell you are using within the operating 
system). I've 
generally found that a number of shells are unable to display even 
iso-8859-1 correctly, which is why I reverted to use of ASCII 
characters only in Saxon error messages. A bit 
disappointing in this day and age.
I'm using win2000 and Java version 1.5.0_10. In my example I 
did not specify an output file so both, the output from 
xsl:message and the output doc are displayed in the command 
shell. Isn't this proof that at least the command shell can 
handle the characters as expected ?

It's easy enough to tell Saxon to send the message somewhere else 
where it won't be mangled, but the question is, where do 
you actually want it?
I would like the error msg stream to be sent to the shell in 
the same way as the output document was sent there. In 
testing, my output doc is normally set to go to a disc file 
so it would not be mixed up with the error messages.

I've seen the -m classname parameter in your documentation, 
but after reading the description I still have no idea what 
to specify - most likely my ignorance in java.

Manfred

-----Original Message-----
From: Manfred Staudinger 
[mailto:manfred(_dot_)staudinger(_at_)gmail(_dot_)com]
Sent: 20 April 2007 21:12
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] using xsl:message with UTF-8 characters

Using XSLT 2.0 with Saxon 8.9.0.3J I would like to use 
xsl:message 
much more, but I don't know how to get
UTF-8 chars displayed correctly. Here is what I get when I invoke 
test.xsl with saxon from the command line:

java net.sf.saxon.Transform dummy.xml test.xsl
a or ?that's the question  <---- I replaced a square by a true ?
<doc>a or ä, that's the question</doc>>Exit code: 0

The square stands for x'E4 AC A0' (which would triggers
base64 encoding in gmail by the way) and the text has not 
only lost 
the "ä"
(x'C3 A4') but also the next 2 bytes ", " (x'C2 20').

Any idea how to get xsl:message working ?

Manfred

test.xsl
<?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet 
version="2.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output omit-xml-declaration="yes"/> <xsl:template match="/"> 
<doc>
  <xsl:message select="'a or ä, that''s the question'"/>
  <xsl:value-of select="'a or ä, that''s the question'"/> </doc> 
</xsl:template> </xsl:stylesheet>


--~-----------------------------------------------------------------
- XSL-List info and archive:  
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--