使用 XSL 时 DOCTYPE 声明丢失 [英] DOCTYPE declaration getting lost when using XSL

查看:21
本文介绍了使用 XSL 时 DOCTYPE 声明丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 XSL 的输入是 XHTML.应用 XSL 后,存在于输入 XHTML 中的 DOCTYPE 声明在输出中丢失.我是否可以选择使用 XSL 在输出中复制/保留 DOCTYPE 声明.我使用的 XSL 处理器是 SAXON.

The input to my XSL is an XHTML. After applying the XSL the DOCTYPE declaration that was present in the input XHTML gets lost in the output. Do i have an option to copy/retain the DOCTYPE declaration in the output using XSL. The XSL processor that i am using is SAXON.

推荐答案

添加输出指令:

<xsl:output 
  doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
  doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
/>

顺便说一下,输出指令可以堆叠 - 您可以根据需要拥有任意数量的指令.

By the way, output directives stack - you can have as many of them as you want.

这篇关于使用 XSL 时 DOCTYPE 声明丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆