Umbraco/示例与文章/XSLT/Sitemap
外观
使用以下 XSLT 来创建站点地图
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" exclude-result-prefixes="msxml umbraco.library"> <xsl:output method="html"/> <xsl:param name="currentPage"/> <xsl:variable name="maxLevelForSitemap" select="6"/> <xsl:template match="/"> <div id="sitemap"> <xsl:call-template name="drawNodes"> <xsl:with-param name="parent" select="$currentPage/ancestor-or-self::node [@level=1]"/> </xsl:call-template> </div> </xsl:template> <xsl:template name="drawNodes"> <xsl:param name="parent"/> <ul> <xsl:for-each select="$parent/node"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> <xsl:call-template name="drawNodes"> <xsl:with-param name="parent" select="."/> </xsl:call-template> </li> </xsl:for-each> </ul> </xsl:template> </xsl:stylesheet>