DDR Treeview菜单显示选定的根及其子节点

use*_*367 6 xml asp.net xslt treeview dotnetnuke

我正在为DotNetNuke的DDR Treeview菜单工作,只显示所选的Root项及其要扩展的子节点.这是我想要实现的目标.(左垂直菜单)有什么建议吗?

在此输入图像描述

这是xslt代码,目前显示所有根项.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html"/>
  <xsl:param name="ControlID" />
  <xsl:param name="Options" />
  <xsl:template match="/*">
    <xsl:apply-templates select="root" />
  </xsl:template>
  <xsl:template match="root">
    <xsl:if test="node">
      <ul class="treeview filetree" id="{$ControlID}">
        <xsl:apply-templates select="node" />
      </ul>
      <script type="text/javascript">
        jQuery(function($) {
          $("#<xsl:value-of select="$ControlID" />").treeview(
            <xsl:value-of select="$Options" disable-output-escaping="yes" />
          );
        });
      </script>
    </xsl:if>
  </xsl:template>
  <xsl:template match="node">
    <li>
      <xsl:if test="node and (@depth != 0 or @breadcrumb = 1)">
        <xsl:attribute name="class">open</xsl:attribute>
      </xsl:if>
      <xsl:choose>
        <xsl:when test="@enabled = 0">
          <xsl:value-of select="@text" />
        </xsl:when>
        <xsl:otherwise>
          <a href="{@url}">
            <xsl:choose>
              <xsl:when test="@selected=1">
                <xsl:attribute name="class">selected breadcrumb</xsl:attribute>
              </xsl:when>
              <xsl:when test="@breadcrumb=1">
                <xsl:attribute name="class">breadcrumb</xsl:attribute>
              </xsl:when>
            </xsl:choose>
            <xsl:value-of select="@text" />
          </a>
        </xsl:otherwise>
      </xsl:choose>
      <xsl:if test="node">
        <ul style="list-item-style:none">
          <xsl:apply-templates select="node" />
        </ul>
      </xsl:if>
    </li>
  </xsl:template>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)

bdu*_*kes 0

如果您只获取根项目,您将需要更改NodeSelector菜单的定义。我相信速记值RootChildren会给你你想要的。