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 node, Double
index)
at (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current)
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)
Can anyone suggest what how to get this to run without the error?
Thanks Lachlann - good spot on the {url}s - sorted those. However, the variable linkID should be returning a node ID - to be double sure I hard coded a node id into the line where the niceURL is called, and still same error.
Also have you tried turning off error reporting and saving it anyway, I find that sometime even though it throws an error when you save it runs fine when its actually on the page.
I'm getting somewhere, but there appears to be a weird issue whereby the data on the node is only returned in the first iteration of the loop - even though the $index variable is incrementing okay. I've stripped out most of my HTML and hard-coded one of the field aliases just to demonstrate the issue:
Just to help you understand why you didn't get the expected output...
When you first call the outputImageListImage template, you do so from within the root template (match="/") - you pass in $currentPage to the "node" parameter, which gets you the first output because $currentPage has that property (data[@alias = 'box1Title']) - when you call the template again (from within itself) you don't pass an argument to the $node parameter, so it'll take the default which you've specified (select=".").
Now that dot means to use the "current context node" which will actually fall back to the "/" from when you called it the first time (because it hasn't been changed since) and you'll probably be a little surprised if you try to examine that one, 'coz it'll hold only a <macro> element (possibly with some childnodes if the macro has parameters).
To fix the template at that stage, you could send the existing $node parameter on to the next iteration:
Problem with template/loop
Hi,
I have a macro which iterates through 6 items and outputs some links and images for each one. The code is as follows:
However, when I save this I get the old error:
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 node, Double index)
at (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current)
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)
Can anyone suggest what how to get this to run without the error?
Hi Dan,
Just had a quick look thorugh your code and Im not entirley sure about
the variable linkID is then passed to NiceURL which will be expecting a node ID to create a URL with. could this be causeing your issue?
Also this code
should probably have a $ before the url variable.
Hope this helps
L
Oh no wait my bad, I see what you are doing.
have you tried putting /@id on the end of
L
Thanks Lachlann - good spot on the {url}s - sorted those. However, the variable linkID should be returning a node ID - to be double sure I hard coded a node id into the line where the niceURL is called, and still same error.
Hmm have you looked at hard coding a media id for the GetMedia funciton, that is hte other one i know tends to throw the int32 errors
Also have you tried turning off error reporting and saving it anyway, I find that sometime even though it throws an error when you save it runs fine when its actually on the page.
L
I'm getting somewhere, but there appears to be a weird issue whereby the data on the node is only returned in the first iteration of the loop - even though the $index variable is incrementing okay. I've stripped out most of my HTML and hard-coded one of the field aliases just to demonstrate the issue:
I've put asterisks around the output, and here's what's returned:
Really, what I'm expecting here, whilst the 'box1Title' is hard-coded is:
When that's working I can then hook up boxXTitle to use the $index value to return the appropriate title for that item in the loop.
Can you see why 'box1Title' is only returned on the first loop, and is blank on the other iterations? I think this is the crux of my issue.
Got around it by just referencing $currentPage instead of $node, and that's sorted it.
Thanks for your help Lachlann - the check on the mediaID value kind of pointed me in the right direction.
Hi Dan,
Just to help you understand why you didn't get the expected output...
When you first call the outputImageListImage template, you do so from within the root template (match="/") - you pass in $currentPage to the "node" parameter, which gets you the first output because $currentPage has that property (data[@alias = 'box1Title']) - when you call the template again (from within itself) you don't pass an argument to the $node parameter, so it'll take the default which you've specified (select=".").
Now that dot means to use the "current context node" which will actually fall back to the "/" from when you called it the first time (because it hasn't been changed since) and you'll probably be a little surprised if you try to examine that one, 'coz it'll hold only a <macro> element (possibly with some childnodes if the macro has parameters).
To fix the template at that stage, you could send the existing $node parameter on to the next iteration:
Hope that helps you understand why it failed...
/Chriztian
Ace, thanks Chriztian!
is working on a reply...