Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • MRavensholt 19 posts 39 karma points
    Dec 16, 2010 @ 15:17
    MRavensholt
    0

    problem with umbraco 4.5.x generating a submenu xslt

    Hi there. I think I need some help with the new way of developing xslts.

    I've got this sitemap in umbraco:

    http://i55.tinypic.com/x0vjg9.jpg

    But there's something wrong with my xslt, so it doesn't render the sitemap correctly.
    Kalender isn't a childnode to "Ren Artikel", but my xslt renders it that way.

     

    Here's the code:

    <nav>
        <h4>
          <xsl:value-of select="$startItem/menuTitle"/>
        </h4>
        <ul>
          <li>
            <xsl:choose>
              <xsl:when test="$currentPage/@id = $startItem/@id">
                <xsl:attribute name="class">parent active current</xsl:attribute>
              </xsl:when>
              <xsl:otherwise>
                <xsl:attribute name="class">parent active</xsl:attribute>
              </xsl:otherwise>
            </xsl:choose>
            <a>
              <xsl:attribute name="href">
                <xsl:value-of select="umbraco.library:NiceUrl($startItem/@id)"/>
              </xsl:attribute>
              <xsl:value-of select="$startItem/menuTitle"/>
            </a>
            <xsl:if test="count(child::*) > 0">
              <ul>
                <xsl:for-each select="$startItem/*[@isDoc and name() !='IntranetFolder']">
                  <xsl:variable name="leftnav" select="current()/hideFromLeftMenu"/>
                  <xsl:if test="($leftnav != '1' and name() !='IntranetFolder')">
                    <li>
                      <xsl:choose>
                        <xsl:when test="$currentPage/@id = current()/@id">
                          <xsl:attribute name="class">parent active current</xsl:attribute>
                        </xsl:when>
                        <xsl:otherwise>
                          <xsl:choose>
                            <xsl:when test="$currentPage/ancestor-or-self::*/@id = current()/@id">
                              <xsl:attribute name="class">parent active</xsl:attribute>
                            </xsl:when>
                            <xsl:otherwise>
                              <xsl:attribute name="class">parent</xsl:attribute>
                            </xsl:otherwise>
                          </xsl:choose>
                        </xsl:otherwise>
                      </xsl:choose>
                      <a>
                        <xsl:attribute name="href">
                          <xsl:value-of select="umbraco.library:NiceUrl(current()/@id)"/>
                        </xsl:attribute>
                        <xsl:value-of select="current()/menuTitle"/>
                      </a>
                      <xsl:if test="count(child::*) > 0">
                        <ul>
                          <xsl:for-each select="current()/*[@isDoc and name() !='IntranetFolder']">
                            <xsl:variable name="curleftnav" select="current()/hideFromLeftMenu"/>
                            <xsl:if test="($curleftnav != '1' and name() !='IntranetFolder' )">
                              <li>
                                <xsl:choose>
                                  <xsl:when test="$currentPage/ancestor-or-self::*/@id = current()/@id">
                                    <xsl:attribute name="class">active current</xsl:attribute>
                                  </xsl:when>
                                </xsl:choose>
                                <a>
                                  <xsl:attribute name="href">
                                    <xsl:value-of select="umbraco.library:NiceUrl(current()/@id)"/>
                                  </xsl:attribute>
                                  <xsl:value-of select="current()/menuTitle"/>
                                </a>
                              </li>
                            </xsl:if>
                          </xsl:for-each>
                        </ul>
                      </xsl:if>
                    </li>
                  </xsl:if>
                </xsl:for-each>
              </ul>
            </xsl:if>
          </li>
        </ul>
      </nav>

     

    Any ideas why Kalender is rendered as a childnode to "Ren Artikel" even when it's not inside Umbraco?

  • MRavensholt 19 posts 39 karma points
    Dec 16, 2010 @ 15:18
    MRavensholt
    0

    http://i53.tinypic.com/xqhyip.jpg

    This is how it's rendered in the html :(

  • MRavensholt 19 posts 39 karma points
    Dec 16, 2010 @ 16:08
    MRavensholt
    0

    Ok, so I fixed it my self.

    it was a problem with my count. the menu wrote empty <ul> elements.

  • Thijs Kuipers 43 posts 66 karma points
    Dec 16, 2010 @ 16:10
    Thijs Kuipers
    0

    You might want to consider using (named) templates that recursively call themselves. DRY!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies