Xml 在XSLT Mega菜单下拉列表中显示链接

Xml 在XSLT Mega菜单下拉列表中显示链接,xml,xslt,href,megamenu,Xml,Xslt,Href,Megamenu,我试图在xslt mega菜单代码的底部添加一个div,以显示超链接“全部查看”按钮/操作调用,但无法显示任何内容。我的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"/

我试图在xslt mega菜单代码的底部添加一个div,以显示超链接“全部查看”按钮/操作调用,但无法显示任何内容。我的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:param name="subMenuColumns">1</xsl:param>
  <xsl:param name="subpointer"><![CDATA[]]></xsl:param>
  <xsl:param name="pointer"><![CDATA[]]></xsl:param>
  <xsl:param name="startUl"><![CDATA[<ul>]]></xsl:param>
  <xsl:param name="endUl"><![CDATA[</ul>]]></xsl:param>
  <xsl:template match="/*">
    <xsl:apply-templates select="root" />
  </xsl:template>
  <xsl:template match="root">
    <script type="text/javascript">
      function splitSubMenu(columns) {
      jQuery("div.sub").each(function (i) {
      if (i==1) {
      columns=4;
      } else {
      columns=4;
      }
      var items = jQuery(this).find('ul');
      var blockCount = columns;
    </script>
    <ul class="megamenu" id="megamenu">
      <xsl:apply-templates select="node">
        <xsl:with-param name="level" select="0"/>
      </xsl:apply-templates>
    </ul>
  </xsl:template>
  <xsl:template match="node">
    <xsl:param name="level" />
    <xsl:choose>
      <xsl:when test="$level=0">
        <li>
          <xsl:attribute name="class">
            level0 <xsl:if test="@breadcrumb = 1">current</xsl:if>
          </xsl:attribute>
          <a>
            <xsl:attribute name="class">
              level0 <xsl:if test="@breadcrumb = 1">current</xsl:if>
            </xsl:attribute>
            <xsl:choose>
              <xsl:when test="@enabled = 1">
                <xsl:attribute name="href">
                  <xsl:value-of select="@url"/>
                </xsl:attribute>
              </xsl:when>
              <xsl:otherwise>
                <xsl:attribute name="href">#</xsl:attribute>
                <xsl:attribute name="onclick">return false</xsl:attribute>
              </xsl:otherwise>
            </xsl:choose>
            <xsl:value-of select="@text" />
            <xsl:if test="node">
              <xsl:value-of select="$pointer" disable-output-escaping="yes"/>
            </xsl:if>
          </a>
          <xsl:if test="node">
            <div class="sub">
              <xsl:apply-templates select="node">
                <xsl:with-param name="level" select="$level + 1" />
              </xsl:apply-templates>

            </div>

          </xsl:if>
        </li>
      </xsl:when>
      <xsl:when test="$level=1">
        <ul class="megamenusubcontent">
          <li class="subheader">
            <h2>
              <a>
                <xsl:choose>
                  <xsl:when test="@enabled = 1">
                    <xsl:attribute name="href">
                      <xsl:value-of select="@url"/>
                    </xsl:attribute>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:attribute name="href">#</xsl:attribute>
                    <xsl:attribute name="onclick">return false</xsl:attribute>
                  </xsl:otherwise>
                </xsl:choose>
                <xsl:value-of select="@text" />
              </a>
            </h2>
          </li>

          <xsl:if test="node">
            <xsl:apply-templates select="node">
              <xsl:with-param name="level" select="$level + 1" />
            </xsl:apply-templates>
          </xsl:if>

        </ul>

      </xsl:when>

      <xsl:otherwise>
        <li class="sublink">
          <a>
            <xsl:choose>
              <xsl:when test="@enabled = 1">
                <xsl:attribute name="href">
                  <xsl:value-of select="@url"/>
                </xsl:attribute>
              </xsl:when>
              <xsl:otherwise>
                <xsl:attribute name="href">#</xsl:attribute>
                <xsl:attribute name="onclick">return false</xsl:attribute>
              </xsl:otherwise>
            </xsl:choose>
            <xsl:value-of select="@text" />
          </a>
        </li>
        <xsl:if test="node">
          <xsl:apply-templates select="node">
            <xsl:with-param name="level" select="$level + 1" />
          </xsl:apply-templates>
        </xsl:if>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
</xsl:stylesheet>

1.
]]>
]]>
函数拆分子菜单(列){
jQuery(“div.sub”)。每个功能(i){
如果(i==1){
列=4;
}否则{
列=4;
}
var items=jQuery(this.find('ul');
var blockCount=列;
  • 0级电流
  • 实际上有两个问题,1)我将使用什么xsl翻译在我的超级菜单底部显示一个“查看全部”链接,类似于以下内容:

    2) 我在xslt模板中的什么位置插入,使其显示在mega菜单下拉列表中所有菜单列表的底部

    我尝试了以下方面的变化,但屏幕上仍然没有显示任何内容:

      <xsl:template match="url">
        <a href="{.}">
          <xsl:value-of select="../view-all"/>
        </a>
      </xsl:template>
    
    
    

    干杯

    最后,我将我的超级菜单中的最后一个li作为“全部查看”页面,并使用相应的css样式