Copied to clipboard

Flag this post as spam?

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


  • Sam 63 posts 126 karma points
    Aug 02, 2011 @ 12:39
    Sam
    0

    Get error - Value was either too large or too small for an Int32.

    Hi All ,

    Am gettin this erro when trying to save mu xslt...i know that its  a problem with this line :

    <xsl:variable name="listImage" select="umbraco.library:GetMedia($mediapickerproperty, 1)"/>

    cos when i save skipping errors it works....

     

    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage" />
    <xsl:variable name="listImage" select="umbraco.library:GetMedia($mediapickerproperty, 1)"/>      
    <xsl:variable name="itemsPerPage" select="7"/>
    <xsl:variable name="numberOfItems" select="count($listImage/Image)"/>
    <xsl:variable name="pageNumber">
      <xsl:choose>
        <xsl:when test="umbraco.library:RequestQueryString('page') = ''">
          <xsl:value-of select="1"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="umbraco.library:RequestQueryString('page')"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>  
     
    <xsl:variable name="mediapickerproperty" select="$currentPage/linkToGallery"/> <!-- datatype property for the mediapicker -->        
                     
    <xsl:template match="/">


    <xsl:if test="$mediapickerproperty &gt; 0">
      
      <xsl:for-each select="$listImage/Image">
        <xsl:if test="position() &gt; $itemsPerPage * number($pageNumber -1) and position() &lt;= number($itemsPerPage * number($pageNumber -1) + $itemsPerPage)">
             
             
                 <div class="miniPhotoCn">
                    <div class="miniPhotoCnImg">
                    <a>
                      <xsl:attribute name="href">
                        <xsl:value-of select="umbraco.library:GetMedia(@id, 0)/umbracoFile"/>
                      </xsl:attribute>
                      <xsl:attribute name="rel">
                        <xsl:value-of select="string('slideshow')"/>
                     </xsl:attribute>
                      <xsl:attribute name="title">
                       <xsl:value-of select="@nodeName"/>
                     </xsl:attribute>
                      
                      <img>
                          <xsl:attribute name="src">
                            <xsl:value-of select="umbraco.library:Replace(umbraco.library:GetMedia(@id, 0)/umbracoFile, '.', '_thumb.')"/>            
                          </xsl:attribute>
                      </img>
                    </a>
                 </div>
                 </div>
        
         </xsl:if>
      </xsl:for-each>
     </xsl:if>            

    <!-- PAGINATOR -->
    <div class="paginatorCn"
      
        <div class="paginator">
         
            PAGE:&nbsp; 
                <!--<xsl:if test="$pageNumber &gt; 1">
              <a href="?page={$pageNumber -1}">previous</a>
            </xsl:if>-->
      
          
        
        <xsl:call-template name="for.loop">
          <xsl:with-param name="i">1</xsl:with-param>
         <xsl:with-param name="count" select="ceiling($numberOfItems div $itemsPerPage)"></xsl:with-param>
        </xsl:call-template>
         

           
       <!-- <xsl:if test="(($pageNumber) * $itemsPerPage) &lt; ($numberOfItems)">
          <a href="?page={$pageNumber +1}">next</a>
         </xsl:if>-->
        </div>
          
    </div
    <!-- END PAGINATOR --> 
      
    </xsl:template>

    <xsl:template name="for.loop">
                    <xsl:param name="i"/>
                    <xsl:param name="count"/>
                    
                    <xsl:if test="$i &lt;= $count">
                            <xsl:if test="$pageNumber != $i">
                                    <href="?page={$i}">
                                            <xsl:value-of select="$i" />
                                    </a>
                            </xsl:if>

                            <xsl:if test="$pageNumber = $i ">
                              <span class="IsActive">
                                     <xsl:value-of select="$i" />
                              </span>
                            </xsl:if>

                            <xsl:call-template name="for.loop">
                                    <xsl:with-param name="i" select="$i + 1" />
                                    <xsl:with-param name="count" select="$count">
                                    </xsl:with-param>
                            </xsl:call-template>
                    </xsl:if>
    </xsl:template
    </xsl:stylesheet>

     

    I know i must put an if statement somewhre for this variable...but can't figure out how..

    Any help out there?

     

    /Sam


  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Aug 02, 2011 @ 13:12
    Dennis Aaen
    0

    Hi Sam,

    I've looked at your code, and I think you get the error because you use the variable before you declare it.

    <xsl:variable name="listImage" select="umbraco.library:GetMedia($mediapickerproperty, 1)"/> 

    You use it in this line, but declares the first lower down in your code before macth.
    Maybe that's why you get the error. Hope at least it can help you.

    /Dennis

  • Sam 63 posts 126 karma points
    Aug 02, 2011 @ 14:31
    Sam
    0

    Dennis,

    its already it this order

    <xsl:variable name="listImage" select="umbraco.library:GetMedia($mediapickerproperty, 1)"/>      
    <xsl:variable name="itemsPerPage" select="7"/>
    <xsl:variable name="numberOfItems" select="count($listImage/Image)"/>

    am declaring the varable before i used it below...double check it and seems to work if i skip error testing,,,any other clue??

    Thks

    /Sam


  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Aug 02, 2011 @ 14:47
    Dennis Aaen
    0

    Hi again Sam,

    What I meant by my explanation was that this variable $mediapickerproperty is first declared just before the template match, but using it in your <xsl: variable name = "list image" select = "umbraco.library: GetMedia ($mediapickerproperty, 1)" />.

    So i think your variable collection should be, but i´m not sure. So I think the $mediapickerproperty must be declared before the $listImage, because you are using the value of the $mediapickerproperty inside the select statement of the $listImage


    <xsl:variable name="mediapickerproperty" select="$currentPage/linkToGallery"/>

    <xsl:variable name="listImage" select="umbraco.library:GetMedia($mediapickerproperty, 1)"/>      
    <xsl:variable name="itemsPerPage" select="7"/>
    <xsl:variable name="numberOfItems" select="count($listImage/Image)"/>

    I hope it makes sense, what I mean.
    And hope it can help you further.

    /Dennis

  • Sam 63 posts 126 karma points
    Aug 02, 2011 @ 14:56
    Sam
    0

    Hi Dennis, ok i understand now...i reordered the variables order but still gettin this error...am trying to figure out another path i found on this link

    http://our.umbraco.org/forum/developers/xslt/1465-XSLT-Error-SystemOverflowException-Value-was-either-too-large-or-too-small-for-an-Int32-

    do you think it might be something like this ? but now i must figure out where to put the if statement...

    Your help is much appreciated.

    /Sam

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Aug 02, 2011 @ 15:20
    Dennis Aaen
    0

    Hi Sam,

    Yes it could be something like that, I think
    I found another post on the same subject maybe it helps too.
    http://our.umbraco.org/forum/developers/xslt/22124-Value-was-either-too-large-or-too-small-for-an-Int32-with-GetMedia

    Don´t know if that will be the solution, but have you tried to add this to see if it worked?

    <xsl:variable name="mediapickerproperty" select="number($currentPage/linkToGallery)"/>

    <xsl:if test="number($mediapickerproperty) &gt; 0">

    /Dennis

  • Sam 63 posts 126 karma points
    Aug 03, 2011 @ 07:01
    Sam
    0

    Hi Dennis,

    Back to work...sorry for late response..have tried your idea but still getting error..I will continue to browse forum for other clues..

    Thks

    /Sam

  • Sam 63 posts 126 karma points
    Aug 03, 2011 @ 07:13
    Sam
    1

    Ok figured it out just rewirte the variables like this :

    <xsl:variable name="mediapickerproperty" select="$currentPage/linkToGallery"/> <!-- datatype property for the mediapicker -->            
    <xsl:variable name="itemsPerPage" select="7"/>
        
    <xsl:variable name="numberOfItems"
    <xsl:if test="$mediapickerproperty &gt; 0">
    <xsl:value-of select="count(umbraco.library:GetMedia($mediapickerproperty,1)/Image)"/>
    </xsl:if>  
    </xsl:variable>

    It does the trick..

    /Sam

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Aug 03, 2011 @ 08:23
    Dennis Aaen
    0

    Okay, Sam, good to hear that you found a solution to your problem.

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft