Copied to clipboard

Flag this post as spam?

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


  • Nicky Christensen 76 posts 166 karma points
    Jan 10, 2012 @ 09:44
    Nicky Christensen
    0

    System.OverflowException: Value was either too large or too small for an Int32.

    Hey Guys....

    Im trying to list some document at the end of this XSLT, however i get an error - It seems that the error occours an the end at this:

    <xsl:if test="$ToolbarFolder != ''">
            <xsl:for-each select="umbraco.library:GetXmlNodeById($ToolbarFolder)/* [@isDoc]">
              <li>
                <xsl:if test="position() = 1">
                  <xsl:attribute name="class">last</xsl:attribute>
                </xsl:if>
                <href="{umbraco.library:NiceUrl(number(umbracoInternalRedirectId))}">
                  <xsl:value-of select="@nodeName"/>
                </a>
              </li>
            </xsl:for-each>
            </xsl:if>

    If i delete this, i dont get an error, however, i dont get my subpages listed also... 
    <?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" 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:key name="document-by-id" match="*[@isDoc]" use="@id"/>
      <xsl:param name="currentPage"/>
      <xsl:template match="/">
        <!--<textarea><xsl:copy-of select="$currentPage/."/></textarea>-->
        <xsl:variable name="ToolbarFolder" select="$currentPage/ancestor-or-self::* [@isDoc and contains(name(),'js_home')] [position()=1]/ToolbarFolder/@id"/>
        <xsl:value-of select="$ToolbarFolder" />
        <nav class="toolbar">
          <ul>        
            
          <xsl:if test="$ToolbarFolder != ''">
            <xsl:for-each select="umbraco.library:GetXmlNodeById($ToolbarFolder)/* [@isDoc]">
              <li>
                <xsl:if test="position() = 1">
                  <xsl:attribute name="class">last</xsl:attribute>
                </xsl:if>
                <href="{umbraco.library:NiceUrl(number(umbracoInternalRedirectId))}">
                  <xsl:value-of select="@nodeName"/>
                </a>
              </li>
            </xsl:for-each>
            </xsl:if>
          </ul>
        </nav>
      </xsl:template>
    </xsl:stylesheet>

     

    Any suggestions? 

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Jan 10, 2012 @ 09:52
    Chriztian Steinmeier
    0

    Hi Nicky,

    This is probably thrown because one of the nodes you're processing has no value in the umbracoInternalRedirectId property (may not even have the property).

    It's always thrown by one of the library methods that take a Node ID (e.g. GetMedia(), NiceUrl(), GetXmlNodeById() etc.)

    You can take the property into to XPath if you're really only interested in nodes with that property, e.g.:

    <xsl:for-each select="umbraco.library:GetXmlNodeById($ToolbarFolder)/*[@isDoc][normalize-space(umbracoInternalRedirectId)]">

    /Chriztian

     

  • Nicky Christensen 76 posts 166 karma points
    Jan 10, 2012 @ 09:54
    Nicky Christensen
    0

    Perfect, that worked :) Thx Chriztian... You Rock! :) 

  • Nicky Christensen 76 posts 166 karma points
    Jan 10, 2012 @ 13:07
    Nicky Christensen
    0

    Hey Chriztian...

    I get the same error on this, do you know why ?

    <xsl:for-each select="umbraco.library:GetXmlNodeById($ToolbarFolder)/*">
                        <li>
                            <a href="{umbraco.library:NiceUrl(@id)}">
                                <xsl:value-of select="@nodeName"/>
                            </a>
                        </li>
                    </xsl:for-each>

    If i normalize-space on the for-each, like you did, then there's a node in the folder that doens't output doesnt't ouput?

    I have 2 nodes/pages, but only one will output if i use the normalize-space[(umbracoInternalRedirectId)]

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Jan 10, 2012 @ 13:17
    Chriztian Steinmeier
    0

    Hi Nicky,

    Check the XML and you'll see why... using only a star in the XPath will get you childnodes AND properties of the selected node(s) up until that point in the XPath. Try adding the DocumentType filter ([@isDoc]) and see if that works.

    Otherwise, there's a node somewhere with a bad value in the property you're sending to NiceUrl().

    /Chriztian 

  • Nicky Christensen 76 posts 166 karma points
    Jan 10, 2012 @ 13:19
    Nicky Christensen
    0

    Ahh, great... isDoc does the trick :) Thx again... :)

Please Sign in or register to post replies

Write your reply to:

Draft