Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I have this blog jonasfotograf.se and I need help with my xslt-schema.
This is how my tree structure looks like:
Hem - Portfolio - Info/Om mig - Priser - Kontakt - Arkiv - rss
And my problem is that I donĀ“t know how to change my xslt to show the Hem-node.
xslt-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 navigation should be --> <xsl:variable name="maxLevel" select="3"/> <xsl:template match="/"> <ul id="menu"> <xsl:call-template name="drawNodes"> <xsl:with-param name="parent" select="$currentPage/ancestor-or-self::* [@level=1 and @isDoc]"/> </xsl:call-template> </ul> </xsl:template> <xsl:template name="drawNodes"> <xsl:param name="parent"/> <xsl:if test="umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id, $parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)"> <xsl:for-each select="$parent/* [@isDoc and string(umbracoNaviHide) != '1' and @level <= $maxLevel]"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:if test="count(./* [@isDoc and string(umbracoNaviHide) != '1' and @level <= $maxLevel]) > 0"> <xsl:attribute name="class"><xsl:text>no-follow</xsl:text></xsl:attribute> </xsl:if> <xsl:value-of select="@nodeName"/> </a> <xsl:if test="count(./* [@isDoc and string(umbracoNaviHide) != '1' and @level <= $maxLevel]) > 0"> <ul> <xsl:call-template name="drawNodes"> <xsl:with-param name="parent" select="."/> </xsl:call-template> </ul> </xsl:if> </li> </xsl:for-each> </xsl:if> </xsl:template></xsl:stylesheet>
The problem is you're passing in the "parent" param as your Hem node, so it's starting out by looking for children under the Hem node.
One way is to manually add the Hem node link in your XSLT file, ex:
<ul id="menu"> <li><a href="/">Hem</a></li> <xsl:call-template name="drawNodes"> <xsl:with-param name="parent" select="$currentPage/ancestor-or-self::* [@level=1 and @isDoc]"/> </xsl:call-template> </ul>
You could also try changing the parent xpath to start at the root "Content" node instead:
<xsl:with-param name="parent" select="$currentPage/ancestor-or-self::root"/>
Hope this helps,Tom
This solved my problem, many thanks!
Best regards Jonas
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Help with xslt-schema
Hi,
I have this blog jonasfotograf.se and I need help with my xslt-schema.
This is how my tree structure looks like:
Hem
- Portfolio
- Info/Om mig
- Priser
- Kontakt
- Arkiv
- rss
And my problem is that I donĀ“t know how to change my xslt to show the Hem-node.
xslt-code:
Hi,
The problem is you're passing in the "parent" param as your Hem node, so it's starting out by looking for children under the Hem node.
One way is to manually add the Hem node link in your XSLT file, ex:
You could also try changing the parent xpath to start at the root "Content" node instead:
Hope this helps,
Tom
Hi,
This solved my problem, many thanks!
Best regards Jonas
is working on a reply...