Question

When I try to run this XSLT style sheet (adapted from http://www.oxygenxml.com/archives/xsl-list/201001/msg00361.html) with Saxon 9.1.0.8 or Saxon-HE 9.5.1.3J, I get an empty output file.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saxon="http://saxon.sf.net/" version="2.0">
  <xsl:output saxon:recognize-binary="yes" method="text"/>
  <xsl:template match="/">
    <?hex 07?>
    <xsl:processing-instruction name="hex" select="'07'"/>
  </xsl:template>
</xsl:stylesheet>

From the Saxon documentation and the message mentioned above, I would have expected that the output is a string containing one (or two) ^G characters. Why did I not get any output at all?

Was it helpful?

Solution

Custom serialization requires Saxon-PE (or EE).

You should've gotten an error similar to this:

Transformation failed: Requested feature (custom serialization {http://saxon.sf.net/}recognize-binary) requires Saxon-PE

http://saxonica.com/documentation/index.html#!extensions

OTHER TIPS

I tried it with Saxon-EE 9.3.0.5 and it works.

Note that you need the xsl:processing-instruction form. Literal PIs in a stylesheet are stripped out, they do not cause processing instructions to be sent to the output.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top