<!-- update this variable on how deep your site map should be --> <!--<xsl:variable name="documentTypeAlias" select="string('Textseite')"/>--> <xsl:template match="/"> <ul> <xsl:variable name="rootNode" select="$currentPage/ancestor-or-self::node [@level=1]" /> <li> <xsl:if test="$rootNode/@id = $currentPage/@id"> <xsl:attribute name="class"> <xsl:text>visited</xsl:text> </xsl:attribute> </xsl:if>
<!-- update this variable on how deep your site map should be --> <!--<xsl:variable name="documentTypeAlias" select="string('Textseite')"/>--> <xsl:template match="/"> <ul> <xsl:variable name="rootNode" select="$currentPage/ancestor-or-self::* [@isDoc][@level=1]" /> <li> <xsl:if test="$rootNode/@id = $currentPage/@id"> <xsl:attribute name="class"> <xsl:text>visited</xsl:text> </xsl:attribute> </xsl:if>
Well, I am not very well versed with the new schema yet, but what you can do is create a new XSLT in umbraco and choose the "Sitemap" template. That will give you most of what you need, you only need to figure out when to apply the "visited" class then, I don't really understand how that works in your current navigation.
Convert to new schema
Hello everybody,
I`d like to convert a old Navigation with Submenus to the new schema.
But it doesn`t work fine.I do not know what I'm doing wrong.
Could someone translate the code?
This is the old schema code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<!-- update this variable on how deep your site map should be -->
<!--<xsl:variable name="documentTypeAlias" select="string('Textseite')"/>-->
<xsl:template match="/">
<ul>
<xsl:variable name="rootNode" select="$currentPage/ancestor-or-self::node [@level=1]" />
<li>
<xsl:if test="$rootNode/@id = $currentPage/@id">
<xsl:attribute name="class">
<xsl:text>visited</xsl:text>
</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl($rootNode/@id)}">
<xsl:value-of select="$rootNode/@nodeName" />
</a>
</li>
<xsl:for-each select="$currentPage/ancestor-or-self::node/node [@level = 2 and string(data[@alias='umbracoNaviHide']) != '1']">
<li>
<xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id">
<xsl:attribute name="class">
<xsl:text>visited</xsl:text>
</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
<xsl:variable name="subItems" select="umbraco.library:GetXmlNodeById(@id)/child::node [string(data [@alias='umbracoNaviHide']) != '1']"/>
<xsl:if test="count($subItems)">
<table><tr><td>
<ul>
<xsl:for-each select="$subItems">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:for-each>
</ul>
</td></tr></table>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
Please help! Thanks a lot!!!
PRK
Have you had a look at the conversion tools out there? Might work just fine out of the box!
Yes, I`ve used this. But it doesn`t work fine.
So, when you try them, what exactly goes wrong? Might just need a few little tweaks to fix them.
I would like to update www.Treetec.at .
The test site is on treetec.kogler-software.at
But it only shows me Home.
This is the translated XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<!-- update this variable on how deep your site map should be -->
<!--<xsl:variable name="documentTypeAlias" select="string('Textseite')"/>-->
<xsl:template match="/">
<ul>
<xsl:variable name="rootNode" select="$currentPage/ancestor-or-self::* [@isDoc][@level=1]" />
<li>
<xsl:if test="$rootNode/@id = $currentPage/@id">
<xsl:attribute name="class">
<xsl:text>visited</xsl:text>
</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl($rootNode/@id)}">
<xsl:value-of select="$rootNode/@nodeName" />
</a>
</li>
<xsl:for-each select="$currentPage/ancestor-or-self::node/* [@isDoc][@level = 2 and string(umbracoNaviHide) != '1']">
<li>
<xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id">
<xsl:attribute name="class">
<xsl:text>visited</xsl:text>
</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
<xsl:variable name="subItems" select="umbraco.library:GetXmlNodeById(@id)/child::* [@isDoc][string(umbracoNaviHide) != '1']"/>
<xsl:if test="count($subItems)">
<table><tr><td>
<ul>
<xsl:for-each select="$subItems">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:for-each>
</ul>
</td></tr></table>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
Thank you'll take the time to my problem.
Sorry for the late reply! I checked your site and it looks like it is working now, did you solve the problem?
Good morning!
No, the Website www.Treetec.at is still under the old scheme.
The new page can be found at treetec.kogler-software.at .
As you can see, The menu only shows me home.
Ah right, I'm sorry, I missed that :-)
Well, I am not very well versed with the new schema yet, but what you can do is create a new XSLT in umbraco and choose the "Sitemap" template. That will give you most of what you need, you only need to figure out when to apply the "visited" class then, I don't really understand how that works in your current navigation.
Hi PRK,
Here's a conversion made by my favorite XSLT "converter tool" (myself, sorry :-)
/Chriztian
I`ve found the solution.
I downloaded the CWS Package and I rewrote the Navigation Code.
This is the code result.
Thanks to all who have dealt with my problem.
That's why I love Umbraco.
Thank`s!!!!
/PRK
is working on a reply...