x First time here? Check out the FAQ

Learn from 350 other Umbracians at the annual Umbraco Conference - CodeGarden '13.
More than twenty high quality sessions, open spaces, hackathons and social events you'll remember. Not to be missed!
Less than 25 tickets left - get yours now!

  • Avatar176posts334karma

    Using niceurl " Value was either too large or too small for an Int32. "

    anthony hall started this topic July 22, 2009 @ 09:47 , this topic was edited at: Tuesday, January 31, 2012 4:26 PM, Go directly to the topic solution

    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)


     

     

     

     


  • Replies

  • Peter Dijksterhuis posted this reply July 22, 2009 @ 09:52

    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:

    <xsl:if test="$datasource != '' ">
    <xsl:param name="parentNode" select="umbraco.library:GetXmlNodeById($datasource)"/>
    </xsl:if>

    HTH,

    PeterD


  • Avatar176posts334karma
    Comment with ID: 10307
    anthony hall posted this reply July 22, 2009 @ 10:04

    cool, all working. thanks Peter. 


  • mikew910 posted this reply October 21, 2010 @ 12:23

    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="/">

     


  • Aron Gamble posted this reply November 3, 2010 @ 12:15

    Have you tried adding an @isDoc check in?

    It fixed it for me..

     


  • Avatar84posts111karma
    Comment with ID: 64641
    Eric Herlitz posted this reply February 10, 2011 @ 08:03

    Anyone got an actually working version of this xslt for 4.6?

    None of the above solutions fixes the problems :/


  • Mikael Lindberg Mortensen posted this reply March 5, 2011 @ 08:28

      <xsl:variable name="source" select="/macro/source"/>
    
    
    <a href="{umbraco.library:NiceUrl(number($source))}" >Go</a>

     

    will do it.

     


  • Lacroix posted this reply June 12, 2011 @ 11:40

    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

     


  • Avatar5060posts8205karma
    admin Comment with ID: 79767
    Jan Skovgaard posted this reply June 12, 2011 @ 02:40

    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


  • Matthew Howell posted this reply October 23, 2011 @ 03:01

    I had this same issue: my parameter was defined without a value, and I solved it by giving it a default value:

    Before:

    <xsl:param name="thumbnailImageId"/>
    <a rel="{umbraco.library:NiceUrl($thumbnailImageId)}"></a>

    After:

    <xsl:param name="thumbnailImageId" select="0"/>
    <a rel="{umbraco.library:NiceUrl($thumbnailImageId)}"></a>

  • priya posted this reply December 8, 2011 @ 12:04

    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)

     

     

     


Pages:

Please login or Sign up To post replies