这是我的设置:
<?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/