Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Thomaspark 5 posts 71 karma points
    Apr 11, 2012 @ 21:12
    Thomaspark
    0

    Umbraco 4.6.2 XSLT Script error

    Hi Guys,

    I have been following some videos on Umbraco TV by Worren, just to get a simple Umbraco Site up and running. I am attempting to create a Dynamic Navigation using Worrens XSLT. When I try and save the script I get the following Error.

    Error occured

    System.OverflowException: Value was either too large or too small for an Int32.
    at System.Convert.ToInt32(Double value)
    at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
    at System.Xml.Xsl.Runtime.XmlQueryRuntime.ChangeTypeXsltArgument(XmlQueryType xmlType, Object value, Type destinationType)
    at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args)
    at (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)
    at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results)
    at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)

    Does anyone have any idea what this is refering to? I'm new to XSLT but under stand it is refuring to a Number that is too big or too small but I can't figure out which part is wrong.

    Here is the XSLT File:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [
        <!ENTITY nbsp "&#x00A0;">
    ]>
    <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"/>
     
      <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 homeNode 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>

    I'm running the following;

    Microsoft Windows Server 2003 R2 x64
    Microsoft .NET 4.0
    SQL CE
    Umbraco 4.6.1

    Any help or any pointer on how to fix this then I would be thank full.

  • Kim Andersen 1447 posts 2197 karma points MVP
    Apr 11, 2012 @ 21:52
    Kim Andersen
    0

    Hi Thomas

    Try changing this piece:

    <!--Create a link to the homepage -->
    <a href="{umbraco.library:NiceUrl($homeNode/@id)}">
        <xsl:value-of select="$homeNode/@nodeName" />
    </a>

    to something like this:

    <!--Create a link to the homepage -->
    <xsl:if test="$homeNode/@id != ''">
    <a href="{umbraco.library:NiceUrl($homeNode/@id)}">
        <xsl:value-of select="$homeNode/@nodeName" />
    </a>
    </xsl:if>

    Does that help?

    /Kim A

Please Sign in or register to post replies

Write your reply to:

Draft