xsl-list
[Top] [All Lists]

RE: [xsl] [XSL] How to display special characters in a xsl:message

2007-10-20 06:49:44

Add the option

-m net.sf.saxon.event.TEXTEmitter

to the command line. This causes xsl:message output to be serialized using
the text output method instead of the XML output method.

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

-----Original Message-----
From: Alain [mailto:alainb06(_at_)free(_dot_)fr] 
Sent: 20 October 2007 14:34
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] [XSL] How to display special characters in a 
xsl:message

Hello XSL List members,

I would like to display characters in a message (eq. through
xsl:message) on the MS-DOS console such as : > (superior, ascii 0x3E)

I tried that :

XSL file :
===================================================
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:template match="/">
<xsl:variable name="msg" select="'>'"/>
<xsl:message><xsl:value-of select="$msg"/></xsl:message> 
<xsl:message><xsl:value-of disable-output-escaping="yes" 
select="$msg"/></xsl:message>
<xsl:message><xsl:value-of disable-output-escaping="no" 
select="$msg"/></xsl:message>
<xsl:message><xsl:text>></xsl:text></xsl:message>
<xsl:message><xsl:text
disable-output-escaping="yes">></xsl:text></xsl:message>
<xsl:message><xsl:text
disable-output-escaping="no">></xsl:text></xsl:message>
<xsl:message><![CDATA[>]]></xsl:message>

<xsl:variable name="msg2" select="'&gt;'"/> 
<xsl:message><xsl:value-of select="$msg2"/></xsl:message> 
<xsl:message><xsl:value-of disable-output-escaping="yes" 
select="$msg2"/></xsl:message>
<xsl:message><xsl:value-of disable-output-escaping="no" 
select="$msg2"/></xsl:message>
<xsl:message><xsl:text>&gt;</xsl:text></xsl:message>
<xsl:message><xsl:text
disable-output-escaping="yes">&gt;</xsl:text></xsl:message>
<xsl:message><xsl:text
disable-output-escaping="no">&gt;</xsl:text></xsl:message>
<xsl:message><![CDATA[&gt;]]></xsl:message>
</xsl:template>
</xsl:stylesheet>


XML File
===================================================
Any valid XML file


Output :
Saxon 8.9J
===================================================
&gt;
&gt;
&gt;
&gt;
&gt;
&gt;
&gt;
&gt;
&gt;
&gt;
&gt;
&gt;
&gt;
&amp;gt;

Xalan1.10
===================================================
XSLT Message: > (...)
XSLT Message: > (...)
XSLT Message: > (...)
XSLT Message: > (...)
XSLT Message: > (...)
XSLT Message: > (...)
XSLT Message: > (...)
XSLT Message: > (...)
XSLT Message: > (...)
XSLT Message: > (...)
XSLT Message: > (...)
XSLT Message: > (...)
XSLT Message: > (...)
XSLT Message: &gt; (...)


==================================================
Although chapter 4.7 of XSLT2.0 norm says that 
disable-output-escaping is deprecated and not REQUIRED to be 
compliant, I would like to be able to have the character '>' 
in the strings output by xsl:message.
Xalan looks right to me, as xsl:message are used for debug 
purpose, or to be nice to the user and tell him what's 
happening when things can be a little time consuming. So 
outputting a '>' through xsl:message has little chance of 
disrupting anything.
Although I prefer Saxon method that displays only what is in 
the xsl:message (and no other string I didn't ask as Xalan 
does) I can't make it output a '>'

But I can't stick with Xalan because I need XSLT2.0 features 
to generated my site.

The XSLT2.0 norm does also says that the feature 
disable-output-escaping is deprecated has been replaced by 
character-map. But character-map looks "global" to me (it 
seams to apply at the xsl:output level), and I want this 
"no-escaping" only on some xsl:message, and not on my regular 
output which should be properly escaped when needed.
For the same reason, I cannot make my output method="text" 
(which has better chances of not escaping!) because I need 
XHTML or HTML as regular output.

Any idea of how to get '>' (or any character XSL will escape) 
on the MS-DOS console as xsl:message result with Saxon8.9 
(without un-escaping '>' everywhere on my regular output) ?

Regards.

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>