<!-- For each child node of the homeNode that is a document (isDoc) and the level is 2 and the property umbracoNaviHide is NOT 1 (true/checked) -->
<xsl:for-each select="$homeNode/* [@isDoc and @level = 2 and string(umbracoNaviHide) != '1']"> <li> <!-- Add the CSS class 'selected' if the currentPage or parent nodes (up the tree to the root) ID matches our current node's ID in the for each loop --> <xsl:if test="$currentPage/ancestor-or-self::* [@isDoc]/@id = current()/@id"> <xsl:attribute name="class"> <xsl:text>selected</xsl:text> </xsl:attribute> </xsl:if>
Try setting a tick in the checkbox saying "Skip testing (ignore errors)". Then you should be able to save the file.
Afterwards try going to the page on the front end and see if the xslt works as expected.
The reason why the file fails when saving is because the code are run, and when this happens the file is not rendered in the correct context, and then the NiceUrl-extension fails.
That has something to do with the NiceUrl extension I guess. Are you sure you have the right home node? Try linking to a slash ( / ) i sted of using the NiceUrl. And try at the same time printing out the homeNode variable to check if you've got the right node. Try with this:
I tried out what you said. When linked to a slash and print out the homeNode variable i get the html text from the homepage. So i guess i have the right home node :)
It's definitly something with the NiceUrl extension, because I saved the XSLT-File without the NiceURL and no Error Message appeared.
now it's working! I checked again the homeNode variable and realised, that the name of the homeNode should be the doctype name and not the name of the homenode from the content-section :)
XSLT System.Overflow Navigation
Hi,
I'm using this XSLT below for my Navigation. The following Error occured when I'm try to save the file:
System.OverflowException: Value was either too large or too small for an Int32.
<?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" />
<xsl:template match="/">
<!-- Root Node -->
<xsl:variable name="rootNode" select="$currentPage/ancestor-or-self::root"/>
<!-- Homepage -->
<xsl:variable name="homeNode" select="$rootNode/Home [@isDoc]"/>
<ul id="navi">
<li>
<!--
Add the CSS class 'selected' if the homNode ID matches our currentPage node ID -->
<xsl:if test="$homeNode/@id = $currentPage/@id">
<xsl:attribute name="class">
<xsl:text>selected</xsl:text>
</xsl:attribute>
</xsl:if>
<!-- Create a link to the homepage -->
<a href="{umbraco.library:NiceUrl($homeNode/@id)}">
<xsl:value-of select="$homeNode/@nodeName" />
</a>
</li>
<!-- For each child node of the homeNode that is a document (isDoc) and the level is 2 and the property umbracoNaviHide is NOT 1 (true/checked) -->
<xsl:for-each select="$homeNode/* [@isDoc and @level = 2 and string(umbracoNaviHide) != '1']">
<li>
<!-- Add the CSS class 'selected' if the currentPage or parent nodes (up the tree to the root) ID matches our current node's ID in the for each loop -->
<xsl:if test="$currentPage/ancestor-or-self::* [@isDoc]/@id = current()/@id">
<xsl:attribute name="class">
<xsl:text>selected</xsl:text>
</xsl:attribute>
</xsl:if>
<!-- Create the link -->
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
any idea?
thanks!
regards netzzeus
Hi netzzeus
Try setting a tick in the checkbox saying "Skip testing (ignore errors)". Then you should be able to save the file.
Afterwards try going to the page on the front end and see if the xslt works as expected.
The reason why the file fails when saving is because the code are run, and when this happens the file is not rendered in the correct context, and then the NiceUrl-extension fails.
I hope that the above helps you out a bit.
/Kim A
Hi Kim A
i saved the file as you said and went to the homepage. on the website this message now appears: Error parsing XSLT file: \xslt\Navi.xslt
what could that be?
thanks!
netzzeus
That has something to do with the NiceUrl extension I guess. Are you sure you have the right home node?
Try linking to a slash ( / ) i sted of using the NiceUrl. And try at the same time printing out the homeNode variable to check if you've got the right node. Try with this:
<textarea><xsl:copy-of select="$homeNode" /></textarea>
/Kim A
Hi Kim A
I tried out what you said. When linked to a slash and print out the homeNode variable i get the html text from the homepage. So i guess i have the right home node :)
It's definitly something with the NiceUrl extension, because I saved the XSLT-File without the NiceURL and no Error Message appeared.
Do you have another idea for this problem?
thanks!
netzzeus
now it's working! I checked again the homeNode variable and realised, that the name of the homeNode should be the doctype name and not the name of the homenode from the content-section :)
thanks for your help Kim A
netzzeus
You're very welcome netzzeus. Glad you got it working in the end :)
/Kim A
is working on a reply...