Copied to clipboard

Flag this post as spam?

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


  • Pete Wilson 11 posts 31 karma points
    Feb 29, 2012 @ 13:36
    Pete Wilson
    0

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

    Hello,

    An odd one, I getted the dreaded

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

    error when saving the following xslt, and am completely puzzled as to why. Can any see anything wrong with my code?

    I can skip testing box, but it's bugging what might be causing it.

    Thanks all

    <?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" xmlns:yorkshire.library="urn:yorkshire.library"
        exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets yorkshire.library ">

    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:template match="/">
    <!-- start writing XSLT -->
           <xsl:for-each select="$currentPage/node[@nodeName='pods']/node[@nodeTypeAlias='Pod']">
            <xsl:variable name="title" select="data [@alias = 'title']" />
           
            <div class="podContainerIndustry">
                <div class="podTitleIndustry"><h3><a href="{umbraco.library:NiceUrl(data[@alias='podLink'])}" class="podTitleLinkIndustry" title="{$title}"><xsl:value-of select="data [@alias = 'title']" disable-output-escaping="yes" /></a></h3></div>
                <div class="podImageIndustry">
                    <a href="{umbraco.library:NiceUrl(data[@alias='podLink'])}"><img src="{umbraco.library:GetMedia(data[@alias='podImage'], 'false')/data}" alt="{$title}" /></a>
                </div>
                <div class="podIndustryCopy"><p><xsl:value-of select="data [@alias = 'podText']" disable-output-escaping="yes" /></p></div>
                <div class="podIndustryLink"><a href="{umbraco.library:NiceUrl(data[@alias='podLink'])}" title="Read more about {$title}"><img src="/images/industry/IndustryReadMoreBtn.png" alt="Read more about {$title}" /></a></div>
            </div>
           </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Feb 29, 2012 @ 13:43
    Tom Fulton
    1

    Hi Pete,

    The error is caused because when you save the XSLT, Umbraco does a "test run" on it, and it may not have values to supply to NiceUrl and GetMedia which both require integers, so if they run without a value it will cause the error above.  You can get around it by checking the "Ignore errors" checkbox, or you can add some code to ensure these calls only run when they have values, ie:

    <xsl:if test="data [@alias='podLink] &gt; 0">
                <div class="podTitleIndustry"><h3><a href="{umbraco.library:NiceUrl(data[@alias='podLink'])}" class="podTitleLinkIndustry" title="{$title}"><xsl:value-of select="data [@alias = 'title']" disable-output-escaping="yes" /></a></h3></div>
    </xsl:if>
    <xsl:if test="data [@alias='podText'] &gt; 0">
                <div class="podImageIndustry">
    <a href="{umbraco.library:NiceUrl(data[@alias='podLink'])}"><img src="{umbraco.library:GetMedia(data[@alias='podImage'], 'false')/data}" alt="{$title}" /></a>
                </div>
    </xsl:if>

    ...etc

    HTH,
    Tom

  • Pete Wilson 11 posts 31 karma points
    Feb 29, 2012 @ 14:05
    Pete Wilson
    0

    Excellent, that worked! many thanks Tom, much appreciated.

    Pete

Please Sign in or register to post replies

Write your reply to:

Draft