html - XSL :include not working at all

标签 html css xml xslt web

这是我的设置:

<?xml version="1.0"?>
<xsl:transform  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:include href="top.xsl"/>  
<xsl:template match="">
Content here - divs and such
</xsl:template>            
</xsl:transform>

这就是我要包含的样式表。

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">
Standard html file now, html, head,title,script,body etc. 

像这样关闭:

<xsl:apply-templates />
        </body>
    </html>
</xsl:template>

</xsl:stylesheet>

为什么 include 不起作用?

编辑:这是完整的代码:https://gist.github.com/anonymous/3432742335a8fd3c600f

最佳答案

当你做 <xsl:apply-templates />在你的nav.xsl这将查找文档节点的子节点。由于 XML 需要一个单一的根元素来保证格式正确,你可以用这个替换你当前空的模板匹配来匹配这个根元素

<xsl:template match="/*" >

关于html - XSL :include not working at all,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27344931/

相关文章:

javascript - 使用javascript在html中幻灯片放映..图像发生变化但无法正确显示

文本后的 CSS 边框底部

php - 绘制锦标赛括号(基于 PHP 数据集的 CSS/HTML)

html - 为什么我的 html 表格不会在 IE 11 的页面上居中?

android - WebView iframe 忽略 frameborder ="0"

html - Chrome : Div has white line in center

asp.net - 如何从 c#.net 中的图表组件中删除 alt 样式?

swift - 使用带有 Alamofire 的 SWXMLHash 解析 xml 时出错

php - 使用 PHP DOMDocument 将输出格式化为文件

java - 我该如何使用 GenyMotion 解决这个问题?