[英]XSLT apply a template with a condition in the path
我是XSLT的新手,所以我嘗試應用特定的模板(標頭組件),然后加載除標頭模板之外的所有模板。
<html>
<head>
<title>My page</title>
</head>
<body>
<div class="header">
<xsl:apply-templates select="page-components/header-component"/>
</div>
<div>
<xsl:apply-templates select="page-components/*"/>
</div>
</body>
</html>
在我的解決方案中,標頭組件被加載了兩次(很明顯)。
而不是寫作
<xsl:apply-templates select="page-components/*"/>
寫吧
<xsl:apply-templates select="page-components/*[not(name()='header-component')]"/>
排除您已經處理過的元素。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.