2014-12-07 69 views
0

在這裏工作是我的設置:XSL:包括根本

<?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> 

爲什麼不包括工作?

編輯:這裏是全碼:https://gist.github.com/anonymous/3432742335a8fd3c600f

+1

「*爲什麼不包含工作?*」您如何確定它不?請發佈一些**可重現的**代碼。 ''會導致包含或不包含致命錯誤。 – 2014-12-07 17:00:08

+0

我已經在OP中發佈了完整的代碼。 – 2014-12-07 17:06:14

+0

我建議你在這裏發佈一個最小但完整的示例(XML + XSLT)。 – 2014-12-07 17:09:00

回答

0

當你在做nav.xsl<xsl:apply-templates />將查找文檔節點的子節點。由於XML需要單個根元素的格式良好,您可以用此替換當前的空模板匹配以匹配此根元素

<xsl:template match="/*" > 
+0

完美。謝謝。 – 2014-12-07 17:35:26