I'm working on a solution which contained a sitemap. In this context, I have some questions. I use a standard sitemap from Umbraco. I'm using version 4.5.1
My question is as follows, how can I exclude Level 4 but still get level 5 out. Level 5 is way under Level 4
Another question. When I've got the right data, how can I provide different levels classes, so they can have different styles.
For example, the level one becomes bold with the color black and each of the elements of Level 5 get a - in front of all links and get margin-left on for example 15 px.
Some sitemap quistions
Hi
I'm working on a solution which contained a sitemap. In this context, I have some questions.
I use a standard sitemap from Umbraco. I'm using version 4.5.1
<?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" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
<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="maxLevelForSitemap" select="5"/>
<xsl:template match="/">
<div id="sitemap">
<xsl:call-template name="drawNodes">
<xsl:with-param name="parent" select="$currentPage/ancestor-or-self::* [@isDoc and @level=1]"/>
</xsl:call-template>
</div>
</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)">
<ul><xsl:for-each select="$parent/* [@isDoc and string(umbracoNaviHide) != '1' and @level <= $maxLevelForSitemap][name()!='xx_products'][name()!='xx_cases'][name()!='xx_nyheder'][name()!='xx_medarbejdere']">
<li>
<xsl:value-of select="@level"/>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/></a>
<xsl:if test="count(./* [@isDoc and string(umbracoNaviHide) != '1' and @level <= $maxLevelForSitemap]) > 0">
<xsl:call-template name="drawNodes">
<xsl:with-param name="parent" select="."/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
My structure is as follows.
Level 2 -> Level 3 -> Level 4 and Level 5th
My question is as follows, how can I exclude Level 4 but still get level 5 out. Level 5 is way under Level 4
Another question. When I've got the right data, how can I provide different levels classes, so they can have different styles.
For example, the level one becomes bold with the color black and each of the elements of Level 5 get a - in front of all links and get margin-left on for example 15 px.
Hope some can help me.
/ Dennis
I found a solution to my question, and thought that others might use the answer.
I solved the problem as follows.
The way I gave names to the different classes so I could style them using my style sheet was as follows.
I should also exclude level 4 but still keep level 5th This prolem I solved this way.
My level 5 should have - in front of all links that I solved with an xsl chose as shown below
So the whole xslt code came to look like this
Hope there are others who can use this answer
/ Dennis
is working on a reply...