Copied to clipboard

Flag this post as spam?

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


  • Timothy Pauwels 3 posts 23 karma points
    May 02, 2012 @ 15:27
    Timothy Pauwels
    0

    Value was either too large or too small for an Int16.

    Hi,

    When I use the PDCalendar on a live site it doesn't want to generate the xslt.

    It gives this error:

    Error occured
    System.OverflowException: Value was either too large or too small for an Int16.
    
    at System.Int16.Parse(String s, NumberStyles style, NumberFormatInfo info)
    at PDCalendar.library.(String , String )
    at PDCalendar.library.GenerateDates(String _start, String _end, String _alias)

     

    For GenerateDates example that was used: GenerateDates('2012-05-07', '2012-05-13', event)

    When I test this on my localhost however, it works flawlessly.
    I'm stuck with this some time and can't find the problem..

    All help is welcome!

    Timo

     

  • Jan Skovgaard 11256 posts 23495 karma points MVP 7x admin c-trib
    May 02, 2012 @ 20:09
    Jan Skovgaard
    0

    Hi Timothy

    Where do you see this error? Is it when you're saving the xslt in the umbraco xslt editor? Then it's probably because of some runtime stuff where the extension does not know the value when it's saved but first when it's run.

    Therefore you could try marking the "skip error testing" to see if that helps.

    If you're editing the xslt file outside of Umbraco then please try posting the XSLT in question and let us have a look :)

    /Jan

  • Timothy Pauwels 3 posts 23 karma points
    May 03, 2012 @ 09:07
    Timothy Pauwels
    0

    Hi Jan,

    Thanks for the fast reply!

    Yes the error pops up when I'm saving the xslt in the xslt-editor.
    I already tried "skip error testing" but then it just doesnt want to parse the xslt file:

    "Error parsing XSLT file: \xslt\PDCUlliCalendar.xslt"

     

    Here is the full code of my PDCUlliCalendar.xslt file.
    It gerenates two Ul Li PDCalenders next to each other.
    I first thought this caused the problem but even though when I only created one PDCalendar, the error pops up.
    I'm still confused why it works locally but not on a live server...

    <?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:exslt="urn:Exslt.ExsltCommon"
      xmlns:date="urn:Exslt.ExsltDatesAndTimes"
      xmlns:umbraco.library="urn:umbraco.library"
      xmlns:pdcalendar ="urn:pdcalendar"
      exclude-result-prefixes="exslt date umbraco.library pdcalendar">


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

    <xsl:param name="currentPage"/>

    <!-- CURRENT MONTH CALENDAR -->
    <xsl:variable name="startdate">
        <xsl:choose>
            <xsl:when test="umbraco.library:RequestQueryString('m') != '' and umbraco.library:RequestQueryString('y') != ''">
                <xsl:value-of select="pdcalendar:GetFirstDOM(umbraco.library:RequestQueryString('y'),umbraco.library:RequestQueryString('m'))" />
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="pdcalendar:GetFirstDOM(date:year(date:date()),date:monthinyear(date:date()))" />
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>

    <xsl:variable name="enddate">
        <xsl:choose>
            <xsl:when test="umbraco.library:RequestQueryString('m') != '' and umbraco.library:RequestQueryString('y') != ''">
                <xsl:value-of select="pdcalendar:GetLastDOM(umbraco.library:RequestQueryString('y'),umbraco.library:RequestQueryString('m'))" />
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="pdcalendar:GetLastDOM(date:year(date:date()),date:monthinyear(date:date()))" />
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
        
    <!-- NEXT MONTH CALENDAR -->
    <xsl:variable name="startMonth">
        <!-- case month = januari -->
        <xsl:if test="number(umbraco.library:RequestQueryString('m')) &gt; 11 or date:monthinyear(date:date()) = 11">
            <xsl:value-of select="1" />
        </xsl:if>
        <!-- case month = feb -> december with requeststring-->
        <xsl:if test="number(umbraco.library:RequestQueryString('m')) &lt; '12'">
            <xsl:value-of select="umbraco.library:RequestQueryString('m') + 1" />
        </xsl:if>   
        <!-- case month = feb -> december without requeststring -->
        <xsl:if test="umbraco.library:RequestQueryString('m') = '' and date:date() != 11">
            <xsl:value-of select="date:monthinyear(date:date()) + 1" />
        </xsl:if>
    </xsl:variable>

    <xsl:variable name="startYear">
        <!-- case we did something the 12+1 = januari variable -->
        <xsl:if test="$startMonth &lt; number(umbraco.library:RequestQueryString('m'))">
            <xsl:value-of select="number(umbraco.library:RequestQueryString('y') + 1)" />
          </xsl:if>
          <!-- case we did nothing -->
        <xsl:if test="$startMonth &gt; number(umbraco.library:RequestQueryString('m'))">
            <xsl:value-of select="umbraco.library:RequestQueryString('y')" />
        </xsl:if>
        <!-- case there is no querystring -->
        <xsl:if test="umbraco.library:RequestQueryString('m') = ''">
            <xsl:value-of select="date:year(date:date())" />
        </xsl:if>
    </xsl:variable>  
        
    <xsl:variable name="startdateNext">
        <xsl:choose>
            <xsl:when test="umbraco.library:RequestQueryString('m') != '' and umbraco.library:RequestQueryString('y') != ''">
              <xsl:value-of select="pdcalendar:GetFirstDOM($startYear,$startMonth)" />
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="pdcalendar:GetFirstDOM($startYear,$startMonth)" />
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>

    <xsl:variable name="enddateNext">
        <xsl:choose>
            <xsl:when test="umbraco.library:RequestQueryString('m') != '' and umbraco.library:RequestQueryString('y') != ''">
                <xsl:value-of select="pdcalendar:GetLastDOM($startYear,$startMonth)" />
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="pdcalendar:GetLastDOM($startYear,$startMonth)" />
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
        
    <!-- EVENTS -->
    <xsl:variable name="fdw" select="pdcalendar:DayOfWeekName($startdate)" />
    <xsl:variable name="fdwNext" select="pdcalendar:DayOfWeekName($startdateNext)" />
    <xsl:variable name="events" select="pdcalendar:GenerateDates($startdate,$enddate,'event')" />
    <xsl:variable name="eventsNext" select="pdcalendar:GenerateDates($startdateNext,$enddateNext,'event')" />    
        <!--
    <xsl:variable name="events" select="pdcalendar:GenerateDates($startdate,$enddate,'event')" />
        -->
    <!--
    In the registered version, you can use a startnode:
    <xsl:variable name="events" select="pdcalendar:GenerateDates($startdate,$enddate,'event',1050)" />
    -->
    <xsl:variable name="days" select="pdcalendar:Days()//day" />
    <xsl:template match="/">
    <xsl:value-of select="umbraco.library:RegisterStyleSheetFile('pdculli', '/css/pdculli.css')"/>
        <table border="0">
            <tr>
                <td align="left" style="width:225px; padding-left:10px;">
                    <a>
                    <xsl:attribute name="href">
                        <xsl:text disable-output-escaping="yes">?m=</xsl:text>
                        <xsl:value-of select="date:monthinyear(date:add($startdate,'-P1D'))"/>
                        <xsl:text disable-output-escaping="yes">&#38;y=</xsl:text>
                        <xsl:value-of select="date:year(date:add($startdate,'-P1D'))"/>
                    </xsl:attribute>
                    Previous
                    </a>
                </td>
                <td align="left">
                    <xsl:value-of select="pdcalendar:MonthName($startdate)"/>&#160;<xsl:value-of select="date:year($startdate)"/>
                </td>
                <td></td>
                <td align="right">
                    <xsl:value-of select="pdcalendar:MonthName($startdateNext)"/>&#160;<xsl:value-of select="date:year($startdateNext)"/>
                </td>
                <td align="right" style="width:225px; padding-right:15px;">
                    <a>
                    <xsl:attribute name="href">
                        <xsl:text disable-output-escaping="yes">?m=</xsl:text>
                        <xsl:value-of select="date:monthinyear(date:add($enddate,'P1D'))"/>
                        <xsl:text disable-output-escaping="yes">&#38;y=</xsl:text>
                        <xsl:value-of select="date:year(date:add($enddate,'P1D'))"/>
                    </xsl:attribute>
                    Next
                    </a>
                </td>
            </tr>
            <tr>
                <td align="left" colspan="2">    
                    <ul class="pdcalendar">
                        <xsl:for-each select="$days">
                            <li class="day"><xsl:value-of select="@weekday"/></li>
                        </xsl:for-each>
                        <xsl:call-template name="createRow">
                            <xsl:with-param name="tailSet">0</xsl:with-param>
                            <xsl:with-param name="offSet" select="$days[@weekday = $fdw]/@position"/>
                            <xsl:with-param name="firstDayinRow" select="$events/node[1]"/>
                        </xsl:call-template>
                    </ul>
                </td>
                <td align="right" colspan="3">   
                    <ul class="pdcalendar">
                        <xsl:for-each select="$days">
                            <li class="day"><xsl:value-of select="@weekday"/></li>
                        </xsl:for-each>
                        <xsl:call-template name="createRow">
                            <xsl:with-param name="tailSet">0</xsl:with-param>
                            <xsl:with-param name="offSet" select="$days[@weekday = $fdwNext]/@position"/>
                            <xsl:with-param name="firstDayinRow" select="$eventsNext/node[1]"/>
                        </xsl:call-template>
                    </ul>
                </td>
            </tr>
        </table>
    </xsl:template>

    <xsl:template name="createRow">
        <xsl:param name="firstDayinRow"/>
        <xsl:param name="offSet"/>
        <xsl:param name="tailSet"/>
        <xsl:param name="DaysToGo" select="count($firstDayinRow/following-sibling::node)"/>
            <xsl:if test="$offSet &gt; 0">
                <xsl:call-template name="createEmptyCells">
                    <xsl:with-param name="no" select="$offSet"/>
                </xsl:call-template>
            </xsl:if>
            <xsl:call-template name="createCells">
                <xsl:with-param name="firstCell" select="$firstDayinRow"/>
                <xsl:with-param name="nrLeft" select="7 - $offSet - $tailSet "/>
            </xsl:call-template>
            <xsl:if test="$tailSet &gt; 0">
                <xsl:call-template name="createEmptyCells">
                    <xsl:with-param name="no" select="$tailSet"/>
                </xsl:call-template>
            </xsl:if>
        <xsl:choose>
            <xsl:when test="$DaysToGo &gt;= 14 - $offSet">
                <xsl:call-template name="createRow">
                    <xsl:with-param name="tailSet">0</xsl:with-param>
                    <xsl:with-param name="offSet">0</xsl:with-param>
                    <xsl:with-param name="firstDayinRow" select="$firstDayinRow/following-sibling::node[7 - $offSet]"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:when test="$DaysToGo &gt;= 7">
                <xsl:call-template name="createRow">
                    <xsl:with-param name="tailSet" select="14 - $DaysToGo -1"/>
                    <xsl:with-param name="offSet">0</xsl:with-param>
                    <xsl:with-param name="firstDayinRow" select="$firstDayinRow/following-sibling::node[7]"/>
                </xsl:call-template>
            </xsl:when>
        </xsl:choose>
     </xsl:template>
     
     <xsl:template name="createCells">
         <xsl:param name="nrLeft"/>
         <xsl:param name="firstCell"/>
         <xsl:choose>
             <xsl:when test="$nrLeft &gt; 0">
                 <xsl:call-template name="createOneCell">
                     <xsl:with-param name="cell" select="$firstCell"/>
                 </xsl:call-template>
                 <xsl:call-template name="createCells">
                     <xsl:with-param name="firstCell" select="$firstCell/following-sibling::node[1]"/>
                     <xsl:with-param name="nrLeft" select="$nrLeft - 1"/>
                 </xsl:call-template>
             </xsl:when>
         </xsl:choose>
     </xsl:template>

    <xsl:template name="createEmptyCells">
        <xsl:param name="no"/>
        <xsl:choose>
            <xsl:when test="$no &gt; 0">
                <li class="empty">&#160;</li>
                <xsl:call-template name="createEmptyCells">
                    <xsl:with-param name="no" select="$no - 1"/>
                </xsl:call-template>
            </xsl:when>
        </xsl:choose>
    </xsl:template>

    <xsl:template name="createOneCell">
        <xsl:param name="cell"/>
        <li>
            <xsl:if test="date:dayinweek($cell/@date) = 1" >
                <xsl:attribute name="class">sunday</xsl:attribute>
            </xsl:if>
            <xsl:if test="date:dayinweek($cell/@date) = 7" >
                <xsl:attribute name="class">saturday</xsl:attribute>
            </xsl:if>
            <xsl:value-of select="date:dayinmonth($cell/@date)"/>
            <xsl:for-each select="$cell/event">
                <br/>TEST
            </xsl:for-each>
        </li>
    </xsl:template>

    </xsl:stylesheet>



    Thanks for helping.

    Timo

  • Jan Skovgaard 11256 posts 23495 karma points MVP 7x admin c-trib
    May 03, 2012 @ 09:27
    Jan Skovgaard
    0

    Hi Timothy

    Ok, before I have a look at the code above I'm curious to find out if you get an error marked with red in the stack trace.

    You can see the stack trace by adding ?umbdebugshowtrace=1 to your url - please post the error message in her as well :)

    /Jan

  • Timothy Pauwels 3 posts 23 karma points
    May 03, 2012 @ 09:50
    Timothy Pauwels
    0

    Hi Jan,

    Here's the first part of the error that was marked red:

    An error occurred during a call to extension function 'GenerateDates'. See InnerException for a complete description of the error.
    An error occurred during a call to extension function 'GenerateDates'. See InnerException for a complete description of the error.
      at System.Xml.Xsl.Runtime.XmlExtensionFunction.Invoke(Object extObj, Object[] args)
      at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args)
      at System.Xml.Xsl.CompiledQuery.Query.events(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) in C:\web\Umbraco\PartsPetersime\xslt\PDCUlliCalendar.xslt:line 96
      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, 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.macro.GetXsltTransformResult(XmlDocument macroXML, XslCompiledTransform xslt, Dictionary`2 parameters)
      at umbraco.macro.loadMacroXSLT(macro macro, MacroModel model, Hashtable pageElements)

     

    The second part of the error was the same error that popped up during the saving of the xslt in the editor.

    Timo

  • Peter Dijksterhuis 1442 posts 1722 karma points
    May 08, 2012 @ 18:45
    Peter Dijksterhuis
    0

    Timo,

    I take it you are using the pdullicallendar.xslt right?

    what happens if you you the very simple xslt (pdcalendar.xslt). Does that throw the same error?

    What's the culture of the website set to?

    Peter

Please Sign in or register to post replies

Write your reply to:

Draft