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:
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 " "> ]>
<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>
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:
...etc
HTH,
Tom
Excellent, that worked! many thanks Tom, much appreciated.
Pete
is working on a reply...