Copied to clipboard

Flag this post as spam?

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


  • anthony hall 222 posts 536 karma points
    Jul 22, 2009 @ 09:47
    anthony hall
    0

    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)


     

     

     

     

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Jul 22, 2009 @ 09:52
    Peter Dijksterhuis
    101

    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

  • anthony hall 222 posts 536 karma points
    Jul 22, 2009 @ 10:04
    anthony hall
    0

    cool, all working. thanks Peter. 

  • mikew910 14 posts 29 karma points
    Oct 21, 2010 @ 12:23
    mikew910
    0

    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 63 posts 76 karma points
    Nov 03, 2010 @ 12:15
    Aron Gamble
    0

    Have you tried adding an @isDoc check in?

    It fixed it for me..

     

  • Eric Herlitz 97 posts 129 karma points
    Feb 10, 2011 @ 20:03
    Eric Herlitz
    0

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

    None of the above solutions fixes the problems :/

  • Mikael Lindberg Mortensen 5 posts 35 karma points
    Mar 05, 2011 @ 08:28
    Mikael Lindberg Mortensen
    0

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

     

    will do it.

     

  • Lacroix 1 post 21 karma points
    Jun 12, 2011 @ 11:40
    Lacroix
    0

    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

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jun 12, 2011 @ 14:40
    Jan Skovgaard
    0

    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 16 posts 36 karma points
    Oct 23, 2011 @ 03:01
    Matthew
    0

    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 25 posts 45 karma points
    Dec 08, 2011 @ 12:04
    priya
    0

    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)

     

     

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Dec 10, 2011 @ 10:06
    Jan Skovgaard
    0

    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.

    • 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

    Hope this helps.

    /Jan

  • priya 25 posts 45 karma points
    Dec 16, 2011 @ 07:31
    priya
    0

    Thanks jan .

    But kindly let me know how to and wht to edit in file.I am new to umbraco.

     

  • Pedro Marques 1 post 21 karma points
    Jan 31, 2012 @ 16:26
    Pedro Marques
    0

    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 "&#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"
      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">&#160;</script>
      <script type="text/javascript" src="/scripts/jquery.tools.scrollable.min.js">&#160;</script>
      <script type="text/javascript" src="/scripts/jquery.scrollto.js">&#160;</script>
      <script type="text/javascript" src="/scripts/jqGallery.js">&#160;</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', '&#160;')" /></h3>
        </xsl:if>
        <xsl:if test="string($galleryDescription) != ''">
          <p><xsl:value-of select="umbraco.library:Replace($galleryDescription, '\r\n', '&#160;')" /></p>
        </xsl:if>
        <div class="main_image">&#160;</div>
        <div class="navi">&#160;</div>
        <div class="gallery_main">
          <a class="prev gal_nav">&#160;</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>&amp;height=400&amp;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>&amp;height=80&amp;compression=100</xsl:text>
                        </xsl:attribute>
                      </img>
                    </a>
                  </li>
                </xsl:if>
              </xsl:for-each>
            </ul>  
          </div> <!--/scrollable-->
          <a class="next gal_nav">&#160;</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!

  • sd75 31 posts 144 karma points
    Jul 25, 2013 @ 18:23
    sd75
    0

     

    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:

     

    href="{umbraco.library:NiceUrl(homemainstorylink)}

    homemainstorylink is a content picker property set for the destination page.

    Where am I going wrong?

     

     
Please Sign in or register to post replies

Write your reply to:

Draft