如何使用xslt显示站点的站点地图/导航?
我有一个网站,有网页和子页面,如图片所附如何使用xslt显示站点的站点地图/导航?,xslt,umbraco,Xslt,Umbraco,我有一个网站,有网页和子页面,如图片所附 <xsl:template name="menu"> <xsl:param name="level"/> <xsl:variable name="RootNode" select="umbraco.library:GetXmlNodeById(1050)" /> <div class="column"> <h1> <a hr
<xsl:template name="menu">
<xsl:param name="level"/>
<xsl:variable name="RootNode" select="umbraco.library:GetXmlNodeById(1050)" />
<div class="column">
<h1>
<a href="{umbraco.library:NiceUrl($RootNode/@id)}" style="width:200px;">
<xsl:value-of select="$RootNode/@nodeName"/>
</a>
</h1>
<xsl:call-template name="submenu_Homepage">
</xsl:call-template>
</div>
<xsl:if test="count($currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<div class="column">
<h1>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</h1>
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</div>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template name="submenu">
<xsl:param name="level"/>
<ul class="level_{@level}">
<xsl:for-each select="current()/*[@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<!--case when we have third menu level-->
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="submenu_Homepage">
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::*/* [@isDoc and string(umbracoNaviHide) = '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</xsl:template>
一些子页面属于第一页(关于患者直接),它们设置为“不在菜单中显示”
<xsl:template name="menu">
<xsl:param name="level"/>
<xsl:variable name="RootNode" select="umbraco.library:GetXmlNodeById(1050)" />
<div class="column">
<h1>
<a href="{umbraco.library:NiceUrl($RootNode/@id)}" style="width:200px;">
<xsl:value-of select="$RootNode/@nodeName"/>
</a>
</h1>
<xsl:call-template name="submenu_Homepage">
</xsl:call-template>
</div>
<xsl:if test="count($currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<div class="column">
<h1>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</h1>
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</div>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template name="submenu">
<xsl:param name="level"/>
<ul class="level_{@level}">
<xsl:for-each select="current()/*[@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<!--case when we have third menu level-->
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="submenu_Homepage">
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::*/* [@isDoc and string(umbracoNaviHide) = '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</xsl:template>
好的,我想制作一个xslt文件,它将生成如下html内容:
<xsl:template name="menu">
<xsl:param name="level"/>
<xsl:variable name="RootNode" select="umbraco.library:GetXmlNodeById(1050)" />
<div class="column">
<h1>
<a href="{umbraco.library:NiceUrl($RootNode/@id)}" style="width:200px;">
<xsl:value-of select="$RootNode/@nodeName"/>
</a>
</h1>
<xsl:call-template name="submenu_Homepage">
</xsl:call-template>
</div>
<xsl:if test="count($currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<div class="column">
<h1>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</h1>
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</div>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template name="submenu">
<xsl:param name="level"/>
<ul class="level_{@level}">
<xsl:for-each select="current()/*[@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<!--case when we have third menu level-->
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="submenu_Homepage">
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::*/* [@isDoc and string(umbracoNaviHide) = '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</xsl:template>
菜单项1(包括主页-关于患者指导)
<xsl:template name="menu">
<xsl:param name="level"/>
<xsl:variable name="RootNode" select="umbraco.library:GetXmlNodeById(1050)" />
<div class="column">
<h1>
<a href="{umbraco.library:NiceUrl($RootNode/@id)}" style="width:200px;">
<xsl:value-of select="$RootNode/@nodeName"/>
</a>
</h1>
<xsl:call-template name="submenu_Homepage">
</xsl:call-template>
</div>
<xsl:if test="count($currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<div class="column">
<h1>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</h1>
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</div>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template name="submenu">
<xsl:param name="level"/>
<ul class="level_{@level}">
<xsl:for-each select="current()/*[@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<!--case when we have third menu level-->
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="submenu_Homepage">
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::*/* [@isDoc and string(umbracoNaviHide) = '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</xsl:template>
-子菜单第1页
<xsl:template name="menu">
<xsl:param name="level"/>
<xsl:variable name="RootNode" select="umbraco.library:GetXmlNodeById(1050)" />
<div class="column">
<h1>
<a href="{umbraco.library:NiceUrl($RootNode/@id)}" style="width:200px;">
<xsl:value-of select="$RootNode/@nodeName"/>
</a>
</h1>
<xsl:call-template name="submenu_Homepage">
</xsl:call-template>
</div>
<xsl:if test="count($currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<div class="column">
<h1>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</h1>
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</div>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template name="submenu">
<xsl:param name="level"/>
<ul class="level_{@level}">
<xsl:for-each select="current()/*[@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<!--case when we have third menu level-->
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="submenu_Homepage">
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::*/* [@isDoc and string(umbracoNaviHide) = '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</xsl:template>
菜单项2(包括主页-关于患者指导)
<xsl:template name="menu">
<xsl:param name="level"/>
<xsl:variable name="RootNode" select="umbraco.library:GetXmlNodeById(1050)" />
<div class="column">
<h1>
<a href="{umbraco.library:NiceUrl($RootNode/@id)}" style="width:200px;">
<xsl:value-of select="$RootNode/@nodeName"/>
</a>
</h1>
<xsl:call-template name="submenu_Homepage">
</xsl:call-template>
</div>
<xsl:if test="count($currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<div class="column">
<h1>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</h1>
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</div>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template name="submenu">
<xsl:param name="level"/>
<ul class="level_{@level}">
<xsl:for-each select="current()/*[@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<!--case when we have third menu level-->
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="submenu_Homepage">
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::*/* [@isDoc and string(umbracoNaviHide) = '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</xsl:template>
-子菜单第2页1
<xsl:template name="menu">
<xsl:param name="level"/>
<xsl:variable name="RootNode" select="umbraco.library:GetXmlNodeById(1050)" />
<div class="column">
<h1>
<a href="{umbraco.library:NiceUrl($RootNode/@id)}" style="width:200px;">
<xsl:value-of select="$RootNode/@nodeName"/>
</a>
</h1>
<xsl:call-template name="submenu_Homepage">
</xsl:call-template>
</div>
<xsl:if test="count($currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<div class="column">
<h1>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</h1>
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</div>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template name="submenu">
<xsl:param name="level"/>
<ul class="level_{@level}">
<xsl:for-each select="current()/*[@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<!--case when we have third menu level-->
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="submenu_Homepage">
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::*/* [@isDoc and string(umbracoNaviHide) = '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</xsl:template>
-子菜单第2页
<xsl:template name="menu">
<xsl:param name="level"/>
<xsl:variable name="RootNode" select="umbraco.library:GetXmlNodeById(1050)" />
<div class="column">
<h1>
<a href="{umbraco.library:NiceUrl($RootNode/@id)}" style="width:200px;">
<xsl:value-of select="$RootNode/@nodeName"/>
</a>
</h1>
<xsl:call-template name="submenu_Homepage">
</xsl:call-template>
</div>
<xsl:if test="count($currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<div class="column">
<h1>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</h1>
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</div>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template name="submenu">
<xsl:param name="level"/>
<ul class="level_{@level}">
<xsl:for-each select="current()/*[@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<!--case when we have third menu level-->
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="submenu_Homepage">
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::*/* [@isDoc and string(umbracoNaviHide) = '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</xsl:template>
我该怎么做?
<xsl:template name="menu">
<xsl:param name="level"/>
<xsl:variable name="RootNode" select="umbraco.library:GetXmlNodeById(1050)" />
<div class="column">
<h1>
<a href="{umbraco.library:NiceUrl($RootNode/@id)}" style="width:200px;">
<xsl:value-of select="$RootNode/@nodeName"/>
</a>
</h1>
<xsl:call-template name="submenu_Homepage">
</xsl:call-template>
</div>
<xsl:if test="count($currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<div class="column">
<h1>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</h1>
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</div>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template name="submenu">
<xsl:param name="level"/>
<ul class="level_{@level}">
<xsl:for-each select="current()/*[@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<!--case when we have third menu level-->
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="submenu_Homepage">
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::*/* [@isDoc and string(umbracoNaviHide) = '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</xsl:template>
这就是我目前所拥有的
<?xml version="1.0" encoding="UTF-8"?>
<xsl:template name="menu">
<xsl:param name="level"/>
<xsl:variable name="RootNode" select="umbraco.library:GetXmlNodeById(1050)" />
<div class="column">
<h1>
<a href="{umbraco.library:NiceUrl($RootNode/@id)}" style="width:200px;">
<xsl:value-of select="$RootNode/@nodeName"/>
</a>
</h1>
<xsl:call-template name="submenu_Homepage">
</xsl:call-template>
</div>
<xsl:if test="count($currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<div class="column">
<h1>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</h1>
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</div>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template name="submenu">
<xsl:param name="level"/>
<ul class="level_{@level}">
<xsl:for-each select="current()/*[@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<!--case when we have third menu level-->
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="submenu_Homepage">
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::*/* [@isDoc and string(umbracoNaviHide) = '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</xsl:template>
]>
<xsl:template name="menu">
<xsl:param name="level"/>
<xsl:variable name="RootNode" select="umbraco.library:GetXmlNodeById(1050)" />
<div class="column">
<h1>
<a href="{umbraco.library:NiceUrl($RootNode/@id)}" style="width:200px;">
<xsl:value-of select="$RootNode/@nodeName"/>
</a>
</h1>
<xsl:call-template name="submenu_Homepage">
</xsl:call-template>
</div>
<xsl:if test="count($currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<div class="column">
<h1>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</h1>
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</div>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template name="submenu">
<xsl:param name="level"/>
<ul class="level_{@level}">
<xsl:for-each select="current()/*[@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<!--case when we have third menu level-->
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="submenu_Homepage">
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::*/* [@isDoc and string(umbracoNaviHide) = '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="menu">
<xsl:param name="level"/>
<xsl:variable name="RootNode" select="umbraco.library:GetXmlNodeById(1050)" />
<div class="column">
<h1>
<a href="{umbraco.library:NiceUrl($RootNode/@id)}" style="width:200px;">
<xsl:value-of select="$RootNode/@nodeName"/>
</a>
</h1>
<xsl:call-template name="submenu_Homepage">
</xsl:call-template>
</div>
<xsl:if test="count($currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<div class="column">
<h1>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</h1>
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</div>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template name="submenu">
<xsl:param name="level"/>
<ul class="level_{@level}">
<xsl:for-each select="current()/*[@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<!--case when we have third menu level-->
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="submenu_Homepage">
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::*/* [@isDoc and string(umbracoNaviHide) = '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</xsl:template>
我还就展开了讨论。我终于成功地完成了我一直在寻找的目标。下面是那些可能正在寻找相同功能的人的代码
<?xml version="1.0" encoding="UTF-8"?>
<xsl:template name="menu">
<xsl:param name="level"/>
<xsl:variable name="RootNode" select="umbraco.library:GetXmlNodeById(1050)" />
<div class="column">
<h1>
<a href="{umbraco.library:NiceUrl($RootNode/@id)}" style="width:200px;">
<xsl:value-of select="$RootNode/@nodeName"/>
</a>
</h1>
<xsl:call-template name="submenu_Homepage">
</xsl:call-template>
</div>
<xsl:if test="count($currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<div class="column">
<h1>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</h1>
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</div>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template name="submenu">
<xsl:param name="level"/>
<ul class="level_{@level}">
<xsl:for-each select="current()/*[@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<!--case when we have third menu level-->
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="submenu_Homepage">
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::*/* [@isDoc and string(umbracoNaviHide) = '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</xsl:template>
]>
<xsl:template name="menu">
<xsl:param name="level"/>
<xsl:variable name="RootNode" select="umbraco.library:GetXmlNodeById(1050)" />
<div class="column">
<h1>
<a href="{umbraco.library:NiceUrl($RootNode/@id)}" style="width:200px;">
<xsl:value-of select="$RootNode/@nodeName"/>
</a>
</h1>
<xsl:call-template name="submenu_Homepage">
</xsl:call-template>
</div>
<xsl:if test="count($currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<div class="column">
<h1>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</h1>
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</div>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template name="submenu">
<xsl:param name="level"/>
<ul class="level_{@level}">
<xsl:for-each select="current()/*[@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<!--case when we have third menu level-->
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="submenu_Homepage">
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::*/* [@isDoc and string(umbracoNaviHide) = '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</xsl:template>
-
底边
-
底边
您也可以转到以了解更多详细信息
<xsl:template name="menu">
<xsl:param name="level"/>
<xsl:variable name="RootNode" select="umbraco.library:GetXmlNodeById(1050)" />
<div class="column">
<h1>
<a href="{umbraco.library:NiceUrl($RootNode/@id)}" style="width:200px;">
<xsl:value-of select="$RootNode/@nodeName"/>
</a>
</h1>
<xsl:call-template name="submenu_Homepage">
</xsl:call-template>
</div>
<xsl:if test="count($currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<div class="column">
<h1>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</h1>
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</div>
</xsl:for-each>
</xsl:if>
</xsl:template>
<xsl:template name="submenu">
<xsl:param name="level"/>
<ul class="level_{@level}">
<xsl:for-each select="current()/*[@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<!--case when we have third menu level-->
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="submenu_Homepage">
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::*/* [@isDoc and string(umbracoNaviHide) = '1']">
<li>
<xsl:if test="position() != last()">
<xsl:attribute name="class">bottom_border</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a href="{current()/linkUrl}" target="_blank">
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</xsl:template>