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 14, 2010 @ 10:18
    MRavensholt
    0

    Umbraco 4.5.2 - Navigation problem

    Hi there.

    I'm currently working on a website based on Umbraco 4.5.2

    I recently developed a website based on an older version, and since the new website uses the same "base-template (html)" I wanted to re-use my xslt renderings. But it seems like something has changed between the latest versions.

    Here's my problem:

    I've got one "root-node" named "Intranet". Beneath this node I've got the different sub-pages.

    <xsl:param name="root" select="$currentPage/ancestor-or-self::node[@nodeName='Intranet']"/>

    <xsl:template match="/">
      <ul>
      <xsl:for-each select="$root/node">
        <xsl:variable name="mainnav" select="current()/data[@alias = 'hideFromTopMenu']"/>
        <xsl:if test="($mainnav != '1')">
          <li>
            <a>
            <xsl:choose>
              <xsl:when test="$currentPage/ancestor-or-self::node/@id = current()/@id">
                <xsl:attribute name="class">active</xsl:attribute>
              </xsl:when>
            </xsl:choose>
              <xsl:attribute name="href">
                <xsl:value-of select="umbraco.library:NiceUrl(@id)"/>
              </xsl:attribute>
            </a>
          </li>
        </xsl:if>
      </xsl:for-each>
    </ul>

    I've checked that $root exists. But the loop never enters xsl:for-each $root/node. I can type anything within the for-each. Nothing gets rendered.

    The reason why I use /node and not decendants-or-self::node is because I only want the childnodes of $root and not all of $root's decendants.

    Any ideas?

    The above solution works fine on an older umbraco-installation.

  • Chris Koiak 700 posts 2626 karma points
    Dec 14, 2010 @ 10:23
    Chris Koiak
    0

    Hi MRavensholt,

    The XML structure was changed in version 4.5. A good write up of the differences is availabel at http://blog.leekelleher.com/2010/04/02/working-with-xslt-using-new-xml-schema-in-umbraco-4-1/

    If you have a look in the App_Data/umbraco.config xml file you'll be able to see the actual XML that's being used.

    Cheers

    Chris

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Dec 14, 2010 @ 10:25
    Aaron Powell
    0

    Or you could stay away from having to know what the XML looks like and write it in IronRuby ;) http://www.aaron-powell.com/umbraco-menu-with-ironruby

  • Chris Koiak 700 posts 2626 karma points
    Dec 14, 2010 @ 10:28
  • MRavensholt 19 posts 39 karma points
    Dec 14, 2010 @ 10:32
    MRavensholt
    0

    Yeah, I figured out they changed the schema, but I couldn't find any xslt tutorials/examples covering this specific issue.

    IronRuby is not something I'd like to look into atm. I prefer .NET and XSLT.

     

    Thanks for the help anyway ;)

  • Chris Koiak 700 posts 2626 karma points
    Dec 14, 2010 @ 10:44
    Chris Koiak
    0

    In most cases changing

    /node to /*[@IsDoc]

    and

    /data[@alias='propertyAlias'] to /propertyAlias

    will do the trick

  • MRavensholt 19 posts 39 karma points
    Dec 14, 2010 @ 13:11
    MRavensholt
    0

    @Chris

    I tried to do the following:

    <UseLegacyXmlSchema>true</UseLegacyXmlSchema> in umbracoSettings.config

    Delete the umbraco.config in /App_data folder.

    Restart the website (just save/overwrite web.config since I can't do an iis reset on our development environment).

    Republish everything....

    The xml in umbraco.config still looks wrong.

    So I changed everything back again and tried the above suggestion using /*[@IsDoc] instead of /node... now this doesn't work either.

     

    Any ideas ... is my installation broke? or?

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Dec 14, 2010 @ 13:21
    Morten Bock
    0

    Note that there is a difference between "Republish entire site" and actually publishing all nodes. Right click on your topmost node:

    Content
    - SomeNode (<-This one)

    And select "Publish". Then check the "Publsih children" checkbox also. Might take a few second for it to finish.

  • MRavensholt 19 posts 39 karma points
    Dec 14, 2010 @ 13:29
    MRavensholt
    0

    @Morten

    I did the "Republish entire site" since I had to republish everything. 

    Wouldn't this be considered a bug, if you need to publish the content's childnodes individually to get the xml right in umbraco.config?

    Anyway... I'll try that in a second, and thanks for the fast answers :D

     

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Dec 14, 2010 @ 13:34
    Morten Bock
    0

    It is by design, but the naming could be better.

    "Republish entire site" will write a new cache file from the _existing_ xml in the database.

    "Publish" will generate new xml in the database, before writing it to the cache file.

  • MRavensholt 19 posts 39 karma points
    Dec 14, 2010 @ 13:41
    MRavensholt
    0

    Thanks :)

    I got it working.

    I'll take a look at the new schema later, and try to figure out how to get my xslt's working that way, since it's the "correct" way now.

Please Sign in or register to post replies

Write your reply to:

Draft