我将xhtml转换为xhtml,但需要将xslt样式表作为生成文档的一部分(样式表将包含在<script type"text/template">
元素中,我使用的是xsl:namespace-alias
指令,这在IE罚款,但在Chrome和Firefox的失败XSLT命名空间别名在Firefox或Chrome中不起作用
下面是相关代码:
<xsl:output doctype-system="about:legacy-compat" omit-xml-declaration="yes" indent="yes" method="html" media-type="application/xhml" encoding="utf-8"/>
<xsl:namespace-alias stylesheet-prefix="wxsl" result-prefix="xsl" />
<xsl:template match="head">
<!-- Some code omitted for clarity -->
<script type="text/template">
<wxsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"
xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:eli="local">
<wxsl:template select="/">
<wxsl:apply-templates />
</wxsl:template>
</wxsl:stylesheet>
</script>
</xsl:copy>
</xsl:template>
它输出在IE浏览器所需要的转换,但对于Firefox和Chrome的XSLT处理器不用xsl
代替wxsl
前缀