Using niceurl " Value was either too large or too small for an Int32. "
I'm getting some weird results using @id on the niceUrl function. Basically it works with a hard code value. But throws the exception if i use an imported value. Do i need to convert to an int. How would i do that from with a the macro.
XSLT.
<!-- if use this value the error message is returned --> <xsl:param name="datasource" select="macro/datasource"/>
<!-- if i use $parentNode/@id error message is return --> <xsl:param name="parentNode" select="umbraco.library:GetXmlNodeById($datasource)"/>
<!-- if i use <xsl:param name="nodeId" select="1132" /> <xsl:template match="/"> <!-- start writing XSLT --> <a class="leftArrow backLink" href="{umbraco.library:NiceUrl($datasource)}"> <xsl:value-of select="$parentNode/@nodeName"/> </a>
<h5> <!-- this works correctly --> <xsl:value-of select="$parentNode/data [@alias = 'heading']"/> </h5>
Error message
System.OverflowException: Value was either too large or too small for an Int32. at System.Convert.ToInt32(Double value) at System.Double.System.IConvertible.ToInt32(IFormatProvider provider) 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 Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results) at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer, Boolean closeWriter) at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results) at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, TextWriter results) 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)
1. check the 'skip testing', thet probably saves the file correctly and should work at the front-end as well (taking that you do not have any other errors in the xslt)
Hi - I have this same problem - except I dont think i can use that fix - at the moment i get "cannot use xsl:if beneath xsl:stylesheet directive" basically a global param at the top of the template like so
Could you tell me where I have to change theses lines ? I'm new to Umbraco, and using JQGallery 1.1 (tried 1.2 too) with umbraco 4.7 and nothing seems to get this to work...
Do you get the exact same error on your page as mentioned above? If so yo can go to the "Developer" section and choose the XSLT folder where you should be able to find your file, and do the trick Peter suggests in the post marked as the solution.
System.OverflowException: Value was either too large or too small for an Int32. at System.Convert.ToInt32(Double value) at System.Double.System.IConvertible.ToInt32(IFormatProvider provider) 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, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, IList`1 currentPage, XPathNavigator propertyName) at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results) at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer) at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, XmlWriter results, XmlResolver documentResolver) 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)
It's most likely because the value you're trying to pass either the umbraco.library:NiceUrl() or umbraco.library:GetMedia() extension is not know untill run time.
So to solve this do one of the following.
Edit the file that is giving you this error outside of Umbraco and it should be working fine
If you edit it in Umbraco you should try checking the "Skip error testing" checkbox
I just installed jqGallery (on Umbraco 4.7.1.1) and am getting the same error. I couldn't fix it with any of the suggestions here. Here is the faulty code (I didn't change it at 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" 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="/"> <!-- for best results remove the lines below, and put them in the <head> of your document --> <link rel="stylesheet" type="text/css" href="/css/jqGallery.css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"> </script> <script type="text/javascript" src="/scripts/jquery.tools.scrollable.min.js"> </script> <script type="text/javascript" src="/scripts/jquery.scrollto.js"> </script> <script type="text/javascript" src="/scripts/jqGallery.js"> </script> <!-- for best results remove the lines above, and put them in the <head> of your document --> <xsl:variable name="imageFolder" select="/macro/imageFolder" /> <xsl:variable name="galleryTitle" select="/macro/galleryTitle" /> <xsl:variable name="galleryDescription" select="/macro/galleryDescription" /> <xsl:variable name="imageFolderContents" select="umbraco.library:GetMedia($imageFolder/Folder/@id, true() )"/> <div class="image_gallery"> <xsl:if test="string($galleryTitle) != ''"> <h3 class="main_gallery_title"><xsl:value-of select="umbraco.library:Replace($galleryTitle, '\r\n', ' ')" /></h3> </xsl:if> <xsl:if test="string($galleryDescription) != ''"> <p><xsl:value-of select="umbraco.library:Replace($galleryDescription, '\r\n', ' ')" /></p> </xsl:if> <div class="main_image"> </div> <div class="navi"> </div> <div class="gallery_main"> <a class="prev gal_nav"> </a> <div class="scrollable"> <ul class="items"> <xsl:for-each select="$imageFolderContents/Folder/Image"> <xsl:if test="string(current()/umbracoFile) != ''"> <li> <a> <xsl:attribute name="href"> <xsl:text>/umbraco/ImageGen.ashx?image=</xsl:text> <xsl:value-of select="./umbracoFile" /> <xsl:text>&height=400&compression=100</xsl:text> </xsl:attribute> <img alt="{current()/@nodeName}"> <xsl:attribute name="src"> <xsl:text>/umbraco/ImageGen.ashx?image=</xsl:text> <xsl:value-of select="./umbracoFile" /> <xsl:text>&height=80&compression=100</xsl:text> </xsl:attribute> </img> </a> </li> </xsl:if> </xsl:for-each> </ul> </div> <!--/scrollable--> <a class="next gal_nav"> </a> </div> <a href="#" class="open_gallery">Click to see the full images</a> </div> </xsl:template> </xsl:stylesheet>
Could someone please show exectly what lines should be changed, or paste functioning code? Thanks!
I'm getting a similar issue. I'm using a media slider on the homepage which did work but now does not display - throws an error parsing xslt on the page. I've turned on debugging to find out exactly where in the xslt file the error is.
Getting the error below which points to an error on line 30 of the xslt file.
umbracoMacro InnerException
Value was either too large or too small for an Int32. 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 System.Xml.Xsl.CompiledQuery.Query.(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, Double {urn:schemas-microsoft-com:xslt-debug}position, Double {urn:schemas-microsoft-com:xslt-debug}last, IList`1 {urn:schemas-microsoft-com:xslt-debug}namespaces) in ...\wwwroot\xslt\imageslider.xslt:line 30 at System.Xml.Xsl.CompiledQuery.Query.(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator , Double , Double ) at System.Xml.Xsl.CompiledQuery.Query.Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at System.Xml.Xsl.CompiledQuery.Query.Execute(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.macro.GetXsltTransformResult(XmlDocument macroXML, XslCompiledTransform xslt, Dictionary`2 parameters) at umbraco.macro.loadMacroXSLT(macro macro, MacroModel model, Hashtable pageElements)
The xslt file saves with no errors - here is line 30 of the xslt file:
Using niceurl " Value was either too large or too small for an Int32. "
I'm getting some weird results using @id on the niceUrl function. Basically it works with a hard code value. But throws the exception if i use an imported value. Do i need to convert to an int. How would i do that from with a the macro.
XSLT.
<!-- if use this value the error message is returned --> <xsl:param name="datasource" select="macro/datasource"/>
<!-- if i use $parentNode/@id error message is return --> <xsl:param name="parentNode" select="umbraco.library:GetXmlNodeById($datasource)"/>
<!-- if i use <xsl:param name="nodeId" select="1132" /> <xsl:template match="/"> <!-- start writing XSLT --> <a class="leftArrow backLink" href="{umbraco.library:NiceUrl($datasource)}"> <xsl:value-of select="$parentNode/@nodeName"/> </a>
<h5> <!-- this works correctly --> <xsl:value-of select="$parentNode/data [@alias = 'heading']"/> </h5>
Error message
System.OverflowException: Value was either too large or too small for an Int32.
at System.Convert.ToInt32(Double value)
at System.Double.System.IConvertible.ToInt32(IFormatProvider provider)
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 Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer, Boolean closeWriter)
at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results)
at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, TextWriter results)
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)
You can do 2 things here.
1. check the 'skip testing', thet probably saves the file correctly and should work at the front-end as well (taking that you do not have any other errors in the xslt)
2. Add an extra check:
HTH,
PeterD
cool, all working. thanks Peter.
Hi - I have this same problem - except I dont think i can use that fix - at the moment i get "cannot use xsl:if beneath xsl:stylesheet directive" basically a global param at the top of the template like so
<xsl:variable name="mediaNode" select="umbraco.library:GetMedia($currentPage/spotImage, false())" />
<xsl:template match="/">
Have you tried adding an @isDoc check in?
It fixed it for me..
Anyone got an actually working version of this xslt for 4.6?
None of the above solutions fixes the problems :/
<a href="{umbraco.library:NiceUrl(number($source))}" >Go</a>
will do it.
Could you tell me where I have to change theses lines ? I'm new to Umbraco, and using JQGallery 1.1 (tried 1.2 too) with umbraco 4.7 and nothing seems to get this to work...
Thank you very much
Hi Lacroix
Do you get the exact same error on your page as mentioned above? If so yo can go to the "Developer" section and choose the XSLT folder where you should be able to find your file, and do the trick Peter suggests in the post marked as the solution.
Hope this helps.
/Jan
I had this same issue: my parameter was defined without a value, and I solved it by giving it a default value:
Before:
After:
I had the same issue:
Error occured
System.OverflowException: Value was either too large or too small for an Int32.
at System.Convert.ToInt32(Double value)
at System.Double.System.IConvertible.ToInt32(IFormatProvider provider)
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, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, IList`1 currentPage, XPathNavigator propertyName)
at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)
at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, XmlWriter results, XmlResolver documentResolver)
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)
Hi Priya
It's most likely because the value you're trying to pass either the umbraco.library:NiceUrl() or umbraco.library:GetMedia() extension is not know untill run time.
So to solve this do one of the following.
Hope this helps.
/Jan
Thanks jan .
But kindly let me know how to and wht to edit in file.I am new to umbraco.
I just installed jqGallery (on Umbraco 4.7.1.1) and am getting the same error. I couldn't fix it with any of the suggestions here. Here is the faulty code (I didn't change it at 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"
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="/">
<!-- for best results remove the lines below, and put them in the <head> of your document -->
<link rel="stylesheet" type="text/css" href="/css/jqGallery.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"> </script>
<script type="text/javascript" src="/scripts/jquery.tools.scrollable.min.js"> </script>
<script type="text/javascript" src="/scripts/jquery.scrollto.js"> </script>
<script type="text/javascript" src="/scripts/jqGallery.js"> </script>
<!-- for best results remove the lines above, and put them in the <head> of your document -->
<xsl:variable name="imageFolder" select="/macro/imageFolder" />
<xsl:variable name="galleryTitle" select="/macro/galleryTitle" />
<xsl:variable name="galleryDescription" select="/macro/galleryDescription" />
<xsl:variable name="imageFolderContents" select="umbraco.library:GetMedia($imageFolder/Folder/@id, true() )"/>
<div class="image_gallery">
<xsl:if test="string($galleryTitle) != ''">
<h3 class="main_gallery_title"><xsl:value-of select="umbraco.library:Replace($galleryTitle, '\r\n', ' ')" /></h3>
</xsl:if>
<xsl:if test="string($galleryDescription) != ''">
<p><xsl:value-of select="umbraco.library:Replace($galleryDescription, '\r\n', ' ')" /></p>
</xsl:if>
<div class="main_image"> </div>
<div class="navi"> </div>
<div class="gallery_main">
<a class="prev gal_nav"> </a>
<div class="scrollable">
<ul class="items">
<xsl:for-each select="$imageFolderContents/Folder/Image">
<xsl:if test="string(current()/umbracoFile) != ''">
<li>
<a>
<xsl:attribute name="href">
<xsl:text>/umbraco/ImageGen.ashx?image=</xsl:text>
<xsl:value-of select="./umbracoFile" />
<xsl:text>&height=400&compression=100</xsl:text>
</xsl:attribute>
<img alt="{current()/@nodeName}">
<xsl:attribute name="src">
<xsl:text>/umbraco/ImageGen.ashx?image=</xsl:text>
<xsl:value-of select="./umbracoFile" />
<xsl:text>&height=80&compression=100</xsl:text>
</xsl:attribute>
</img>
</a>
</li>
</xsl:if>
</xsl:for-each>
</ul>
</div> <!--/scrollable-->
<a class="next gal_nav"> </a>
</div>
<a href="#" class="open_gallery">Click to see the full images</a>
</div>
</xsl:template>
</xsl:stylesheet>
Could someone please show exectly what lines should be changed, or paste functioning code? Thanks!
I'm getting a similar issue. I'm using a media slider on the homepage which did work but now does not display - throws an error parsing xslt on the page. I've turned on debugging to find out exactly where in the xslt file the error is.
Getting the error below which points to an error on line 30 of the xslt file.
Value was either too large or too small for an Int32.
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 System.Xml.Xsl.CompiledQuery.Query.(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, Double {urn:schemas-microsoft-com:xslt-debug}position, Double {urn:schemas-microsoft-com:xslt-debug}last, IList`1 {urn:schemas-microsoft-com:xslt-debug}namespaces) in ...\wwwroot\xslt\imageslider.xslt:line 30
at System.Xml.Xsl.CompiledQuery.Query.(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator , Double , Double )
at System.Xml.Xsl.CompiledQuery.Query.Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at System.Xml.Xsl.CompiledQuery.Query.Execute(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.macro.GetXsltTransformResult(XmlDocument macroXML, XslCompiledTransform xslt, Dictionary`2 parameters)
at umbraco.macro.loadMacroXSLT(macro macro, MacroModel model, Hashtable pageElements)
The xslt file saves with no errors - here is line 30 of the xslt file:
href="{umbraco.library:NiceUrl(homemainstorylink)}
homemainstorylink is a content picker property set for the destination page.
Where am I going wrong?
is working on a reply...