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.
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.
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
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
Or you could use the conversion tools to update your xslt
http://our.umbraco.org/forum/developers/xslt/10462-Simple-tool-to-help-you-convert-xslt-to-the-new-v45-schema
http://our.umbraco.org/projects/developer-tools/xsltupdater-for-umbraco
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 ;)
In most cases changing
and
will do the trick
@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?
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.
@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
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.
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.
is working on a reply...