Create low quality non-printable characters from XLST

I am trying to use XSLT text output to generate a file (in a file format that I do not control), and although it is mostly text, it includes non-standard low-order characters in the form of flags, including characters that are not allowed in the XLST file (in according to XSLT specification).

I would like something like below to work, but instead it is not a valid XSLT file, as it contains characters that are not allowed in XSLT files:

<?xml version="1.0" encoding="US-ASCII" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="text" encoding="US-ASCII"/>
  <xsl:template match="/">&#1;</xsl:template>
</xsl:stylesheet>

I get the following error:

[Fatal Error] :4:35: Character reference "&#1" is an invalid XML character.
ERROR:  'Character reference "&#1" is an invalid XML character.'
FATAL ERROR:  'Could not compile stylesheet'

I also tried with the actual character 1 with or without the CDATA section, xsl: text elements, xslt-2 character maps, several different encodings, but I cannot figure out how to get the ascii character with binary = 1.

, .

XSLT?

: Java 6, XSL Transformer.

+1
2

Java XSLT. , , 0x01 :

<?xml version="1.0" encoding="US-ASCII" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:char="java.lang.Character" version="1.0">
    <xsl:output method="text" encoding="US-ASCII" />
    <xsl:template match="/">
        <xsl:value-of select="char:toString(1)"></xsl:value-of>
    </xsl:template>
</xsl:stylesheet>
+3

, , xsl: param, 0x01.

, , java , , .

, , .

0

Source: https://habr.com/ru/post/1737470/


All Articles