我在乌布拉科宏观中产生了一个菜单:
<xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != 1 and @level <= $maxLevel and (umbraco.library:IsProtected(@id, @path) = false() or umbraco.library:HasAccess(@id, @path) = true())] ">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:for-each>
在座各位中,我想说的是,只接受某种手法,并产生各自的利/标签,并且用手法中这种手法插入一个小数。 我只能认为:
<xsl:if test="$currentPage/Redirect">
<li>
<a href="{$urlRedirect)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:if>
<代码>Redirect为异构体,$urlRedirect
为时段。
与我一样,这是我第一天学习的XSLT。
UPDATE: Heres the complete code so you can see it in context:
<xsl:template match="/">
<!-- The fun starts here -->
<!-- update this variable on how deep your navigation should be -->
<xsl:variable name="maxLevel" select="5"/>
<xsl:variable name="minLevel" select="4"/>
<xsl:choose>
<xsl:when test="$currentPage/* [@isDoc and string(umbracoNaviHide) != 1 and @level <= $maxLevel and (umbraco.library:IsProtected(@id, @path) = false() or umbraco.library:HasAccess(@id, @path) = true())] ">
<ul>
<xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != 1 and @level <= $maxLevel and (umbraco.library:IsProtected(@id, @path) = false() or
umbraco.library:HasAccess(@id, @path) = true())] ">
<!-- Here is where I want my if/else logic -->
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:when>
<xsl:otherwise>
<ul>
<xsl:for-each select="$currentPage/../* [@level > 3 and @isDoc and string(umbracoNaviHide) != 1 and (umbraco.library:IsProtected(@id, @path) = false() or umbraco.library:HasAccess(@id, @path) = true())] ">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:otherwise>
</xsl:choose>
</xsl:template>