[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Character ESC or Hex 0x1B in XSLT


Subject: Re: [xsl] Character ESC or Hex 0x1B in XSLT
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Wed, 06 Oct 2010 08:38:22 +0100

The Unicode codepoint x1B is not a valid character in XML 1.0, but it becomes valid in XML 1.1 provide it is always written as a numerical character reference, e.g.

& # x 1 B ;

without the spaces.

So you need to do two things:

(a) enable XML 1.1 (details depend on your environment, but as a minimum, specify version="1.1" in the XML declaration; you may also need to tell your XSLT processor that you are using XML 1.1)

(b) write the character as a numeric reference, as above.

Michael Kay
Saxonica

On 06/10/2010 6:50 AM, Jimenez, Luis wrote:
Greetings,

how to use the ESC character or 0x1B hex within an XSLT.

I get the following error:

'', hexadecimal value 0x1B, is an invalid character.

The XSL:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" version="1.0" encoding="iso-8859-1" indent="yes"/>
<xsl:strip-space elements="*"/>

   <xsl:template match="/">
     <xsl:for-each select="/spoolpd/pd">
         %-12345X@PJL ==>  LINE WHERE IS THE CHARACTER.
         <xsl:copy-of select="."/>
     </xsl:for-each>
   </xsl:template>

</xsl:stylesheet>

what would be the solution.

Thanks,

Luis Fdo.


Current Thread
Keywords