【问题标题】:xslt text disable-output-escapingxslt 文本禁用输出转义
【发布时间】:2012-04-27 19:24:32
【问题描述】:

使用 XSL 从 XML 创建 HTML 页面 我想知道如何写评论 在生成的 HTML 页面中。

到目前为止,这是我的 XSL:

<?xml version="1.0" encoding="US-ASCII" ?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="html" omit-xml-declaration="no" indent="yes" />
      <xsl:text disable-output-escaping="yes">
        <![CDATA[<!--comment-->]]>
      </xsl:text>
</xsl:stylesheet>

它不起作用,它给出了下一个错误:

Warning: XSLTProcessor::importStylesheet(): compilation error: file mydirectoy/Myxsl.xsl line 4 element text

我怎样才能做到这一点?

【问题讨论】:

    标签: html xml xslt cdata


    【解决方案1】:

    这样做:

    ...
    <xsl:comment>comment</xsl:comment>
    ...
    

    您不会将其包装成xsl:textCDATAxsl:comment 将在结果树中创建一个评论节点。这是规范的链接:http://www.w3.org/TR/xslt#section-Creating-Comments

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多