撒克逊人的用法:识别二元

时间:2014-01-22 16:43:13

标签: xslt binary saxon

当我尝试使用Saxon 9.1.0.8或Saxon-HE 9.5.1.3J运行此X​​SLT样式表(改编自http://www.oxygenxml.com/archives/xsl-list/201001/msg00361.html)时,我得到一个空的输出文件。

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

Saxon documentation和上面提到的消息,我原以为输出是一个包含一个(或两个)^G个字符的字符串。为什么我根本没有得到任何输出?

2 个答案:

答案 0 :(得分:1)

自定义序列化需要Saxon-PE(或EE)。

你应该得到类似的错误:

  

转换失败:请求的功能(自定义序列化   {http://saxon.sf.net/}识别 - 二进制)需要Saxon-PE

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

答案 1 :(得分:1)

我尝试使用Saxon-EE 9.3.0.5并且它可以工作。

请注意,您需要xsl:processing-instruction表单。样本表中的文字PI被删除,它们不会导致处理指令被发送到输出。