Copied to clipboard

Flag this post as spam?

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


  • sauritas 37 posts 57 karma points
    Sep 14, 2010 @ 11:19
    sauritas
    0

    XSLT error

    Hi!

    I am running uForum and I have noticed that there is an error in forum-commentsList.xslt.

     

    Error occured

    System.OverflowException: Valor demasiado grande o demasiado pequeño para Int32.
    en System.Convert.ToInt32(Double value)
    en System.Double.System.IConvertible.ToInt32(IFormatProvider provider)
    en System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
    en System.Xml.Xsl.Runtime.XmlQueryRuntime.ChangeTypeXsltArgument(XmlQueryType xmlType, Object value, Type destinationType)
    en System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args)
    en (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    en Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    en Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    en System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results)
    en System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer, Boolean closeWriter)
    en System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results)
    en System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, TextWriter results)
    en System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results)
    en umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging) en d:\TeamCity\buildAgent\work\7380c184e9fcd3ea\umbraco\presentation\umbraco\webservices\codeEditorSave.asmx.cs:línea 124

     

    Also, I tried to run the Administration extension of uForum developed by Zac, but I can't get it run, maybe is because there is an error in forumAdmin.xslt.

     

    Error occured

    System.Xml.Xsl.XslTransformException: El objeto de extensión 'urn:uForum' no contiene un método 'IsForumAdmin' coincidente que tenga 1 parámetros.
    en System.Xml.Xsl.Runtime.XmlExtensionFunction.Bind()
    en System.Xml.Xsl.Runtime.XmlExtensionFunctionTable.Bind(String name, String namespaceUri, Int32 numArgs, Type objectType, BindingFlags flags)
    en System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args)
    en (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    en Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    en Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    en System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results)
    en System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer, Boolean closeWriter)
    en System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results)
    en System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, TextWriter results)
    en System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results)
    en umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging) en d:\TeamCity\buildAgent\work\7380c184e9fcd3ea\umbraco\presentation\umbraco\webservices\codeEditorSave.asmx.cs:línea 124

     

    Any ideas?

     

    Thanks!

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 14, 2010 @ 11:49
    Dirk De Grave
    0

    First error is due to the fact you're trying to pass a parameter to a function which should have a integer value, but may not have a value until runtime. Add an xsl:if statement around the faulting one should do the trick.

    Second error; it seems you're not using the function IsForumAdmin with the correct number of parameters. Please check the number and type of parameters to pass in.

     

    Hope this helps.

    Regards,

    /Dirk

  • sauritas 37 posts 57 karma points
    Sep 14, 2010 @ 12:26
    sauritas
    0

    Thanks!

     

    I'l try it.

     

    One more question (maybe a silly one)... where can I see the number of parameters of IsForumAdmin?

     

    Here is the code of the archives:

    forum-commentsList.xslt

     

    <?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" xmlns:uForum="urn:uForum"
        xmlns:uForum.raw="urn:uForum.raw" xmlns:uPowers="urn:uPowers"
        exclude-result-prefixes="uPowers uForum.raw msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets uForum ">

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

    <!-- POR AQUI HAY AGUN ERROR -->

       <xsl:template match="/">
           <xsl:variable name="topicID" select="number(umbraco.library:ContextKey('topicID'))"/>
           <xsl:variable name="topic" select="uForum.raw:Topic($topicID)/topics/topic"/>
            <xsl:variable name="maxitems">10</xsl:variable>

            <xsl:variable name="mem">
               <xsl:if test="umbraco.library:IsLoggedOn()">
                    <xsl:value-of select="umbraco.library:GetCurrentMember()/@id"/>
                </xsl:if>
            </xsl:variable>

            <xsl:variable name="p">
               <xsl:choose>
                    <xsl:when test="string(number( umbraco.library:RequestQueryString('p') )) != 'NaN'">
                        <xsl:value-of select="umbraco.library:RequestQueryString('p')"/>
                    </xsl:when>
                    <xsl:otherwise>0</xsl:otherwise>
                </xsl:choose>
            </xsl:variable>


           <xsl:variable name="pages" select="uForum:TopicPager($topicID, $maxitems, $p)"/>

            <!-- start the comment table -->
          
           <table class="forumList commentsList" cellspacing="0">
                <tbody>

                    <xsl:if test="$p = 0">
                       <tr class="post" id="posts-{$topicID}">
                            <td class="author vcard" style="width: 100px">
                                <xsl:call-template name="badge">
                                    <xsl:with-param name="id" select="$topic/memberId" />
                                    <xsl:with-param name="date" select="$topic/created" />
                                </xsl:call-template>
                            </td>

                            <td class="body">
                                <xsl:value-of select="umbraco.library:ReplaceLineBreaks( uForum:Sanitize( uForum:ResolveLinks( $topic/body)))" disable-output-escaping="yes"/>
                            </td>
                        </tr>
                    </xsl:if>
                    <xsl:for-each select="uForum.raw:CommentsByDate($topicID, $maxitems, $p, 'ASC')//comment" >

                        <tr class="spacer">
                            <td colspan="2"></td>
                        </tr>

                        <xsl:call-template name="comment">
                           <xsl:with-param name="comment" select="."/>
                            <xsl:with-param name="topic" select="$topic"/>
                            <xsl:with-param name="mem" select="$mem"/>
                            <xsl:with-param name="collaps" select="false()"/>
                        </xsl:call-template>

                  </xsl:for-each>
                </tbody>
            </table>


            <xsl:if test="count($pages//page) &gt; 1">
                <strong>Páginas: </strong>
                <ul id="searchPager" class="pager">
                    <xsl:for-each select="$pages//page">
                        <li>
                            <xsl:if test="@current = 'true'">
                                <xsl:attribute name="class">current</xsl:attribute>
                            </xsl:if>
                            <a href="?p={@index}">
                                <xsl:value-of select="@index+1"/>
                            </a>
                        </li>
                    </xsl:for-each>
                </ul>
            </xsl:if>

        </xsl:template>

    <!-- FIN DE ALGUN ERROR -->

        <xsl:template name="comment">
            <xsl:param name="comment"/>
            <xsl:param name="topic"/>
            <xsl:param name="collaps"/>
            <xsl:param name="mem"/>

            <tr class="post postComment" id="comment{$comment/id}">

                <xsl:if test="id = $topic/answer">
                    <xsl:attribute name="class">post postComment postSolution</xsl:attribute>
                </xsl:if>

                <xsl:if test="$collaps">
                    <xsl:attribute name="class">post postComment hidden</xsl:attribute>
                </xsl:if>


                <td class="author vcard" style="width: 100px">

                    <xsl:call-template name="badge">
                        <xsl:with-param name="id" select="$comment/memberId" />
                        <xsl:with-param name="date" select="$comment/created" />
                    </xsl:call-template>

                     <xsl:if test="id = $topic/answer">
                        <a name="solution" style="visibility: hidden">Solución</a>
                    </xsl:if>
                   <a name="comment{$comment/id}" style="visibility: hidden">
                        Comentario con ID: <xsl:value-of select="$comment/id"/>
                    </a>

                </td>
                <td class="body">

                    <xsl:value-of select="umbraco.library:ReplaceLineBreaks( uForum:Sanitize( uForum:ResolveLinks($comment/body)))" disable-output-escaping="yes"/>
                </td>
            </tr>


        </xsl:template>

        <xsl:template name="collapsedcomment">
            <xsl:param name="comment"/>
            <tr class="toggle" id="collapsedcomment{$comment/id}">
                <td colspan="3">
                    Este comentario escrito por <em>
                        <xsl:value-of select="umbraco.library:GetMemberName($comment/memberId)"/>
                    </em>
                    tiene una puntuación baja y ha sido ocultado, <a class="forumToggleComment" rel="comment{$comment/id}" href="#">Mostrar de todas formas</a>
                </td>
            </tr>


        </xsl:template>



        <xsl:template name="badge">
            <xsl:param name="id"/>
            <xsl:param name="date"/>
            <xsl:variable name="mem" select="umbraco.library:GetMember($id)"/>

            <div class="memberBadge">
                <span class="date">
                    <abbr class="updated" title="{$date}">
                        <xsl:value-of select="umbraco.library:ShortDate($date, true(), ' ')"/>
                    </abbr>
                </span>

                <span class="fn">
                        <xsl:value-of select="$mem/@nodeName"/>
                </span>

            </div>
        </xsl:template>

    </xsl:stylesheet>

     

    -----------------------------------------------

    --------------------------------------------------

     

    forumAdmin.xslt

     

    <?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"
        xmlns:uForum="urn:uForum"
        xmlns:uForum.utils="urn:uForum.utils"
        xmlns:uForum.raw="urn:uForum.raw" xmlns:uPowers="urn:uPowers"
        exclude-result-prefixes="uPowers uForum.utils uForum.raw msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets uForum ">

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

        <xsl:template match="/">
           
            <xsl:variable name="mem">
                <xsl:if test="umbraco.library:IsLoggedOn()">
                    <xsl:value-of select="umbraco.library:GetCurrentMember()/@id"/>
                </xsl:if>
            </xsl:variable>
       
        <!-- PPSP: Aquí está el fallo... parámetros de IsForumAdmin -->
        <xsl:if test="uForum:IsForumAdmin($mem)">

    <script type="text/javascript">

    function DeleteComment(commentID)
    {
     if(confirm("Are you sure you want to delete this comment?"))
     {
         $.ajax({ 
                     type: "POST", 
                     url: "/usercontrols/uforum.asmx/DeleteComment", 
                     data: "{commentID:" + commentID + "}", 
                     contentType: "application/json; charset=utf-8", 
                     dataType: "json",
                 success: function(result) {
                $('#comment'+commentID).remove();
             }, 
                     error: function(result) {
                 alert("Failed to delete comment");
             }
          }); 
     }
    }
        

    function UpdateComment(commentID, newComment)
    {
     if(confirm("Are you sure you want to update this comment?"))
     { 
         $.ajax({ 
                     type: "POST", 
                     url: "/usercontrols/uforum.asmx/UpdateComment", 
                     data: "{commentID:" + commentID + ", newComment:'"+ $('#comment_'+commentID).val()+"'}", 
                     contentType: "application/json; charset=utf-8", 
                     dataType: "json",
                 success: function(result) {
                 alert("Updated comment");
             }, 
                     error: AjaxFailed
          }); 
     }
    }


    function DeleteTopic(topicID)
    {

     if(confirm("Are you sure you want to delete this topic?"))
     {
         $.ajax({ 
                     type: "POST", 
                     url: "/usercontrols/uforum.asmx/DeleteTopic", 
                     data: "{topicID:" + topicID + "}", 
                     contentType: "application/json; charset=utf-8", 
                     dataType: "json",
                 success: function(result) {
                window.location= parseUrl(document.location.href);
             }, 
                     error: function(result) {
                 alert("Failed to delete topic");
             }
          }); 
     }

    }

    function parseUrl(str)
    {
        return str.substring(0, str.lastIndexOf('/') ) + '.aspx';
       
    }
        

    function UpdateTopicTitle(topicID)
    {
     if(confirm("Are you sure you want to update this topic?"))
     {
         $.ajax({ 
                     type: "POST", 
                     url: "/usercontrols/uforum.asmx/UpdateTopicTitle", 
                     data: "{topicID:" + topicID + ", newTitle:'" + $('#topicTitle').val() +"'}", 
                     contentType: "application/json; charset=utf-8", 
                     dataType: "json",
                 success: function(result) {
                 alert("Updated topic title");
             }, 
                     error: function(result) {
                 alert("Failed to update topic");
             }
          }); 
     }
    }

    function UpdateTopicText(topicID, newTopicText)
    {
     if(confirm("Are you sure you want to update this topic?"))
     {
         $.ajax({ 
                     type: "POST", 
                     url: "/usercontrols/uforum.asmx/UpdateTopicText", 
                     data: "{topicID:" + topicID + ", newTopicText:'" + $('#topicText').val() +"'}", 
                     contentType: "application/json; charset=utf-8", 
                     dataType: "json",
                 success: function(result) {
                 alert("Updated topic text");
             }, 
                     error: function(result) {
                 alert("Failed to update topic");
             }
          }); 
     }
    }
    function AjaxSucceeded(result)

       alert("Successfully deleted"); 
    }           
    function AjaxFailed(result)

       alert(result.status + ' ' + result.statusText); 
    }   
    </script>
        </xsl:if>
        </xsl:template>

    </xsl:stylesheet>

     

     

    Thanks!

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 14, 2010 @ 12:31
    Dirk De Grave
    0

    As these functions are all xlst extensions, you can quite easily include each of these functions using the menu bar (choose 2nd icon  'Insert xslt:value-of') and click on the 'Get extension' button in the dialog. Choose uForum from the drop down and select the appropriate method...

     

    Cheers,

    /Dirk

  • sauritas 37 posts 57 karma points
    Sep 14, 2010 @ 17:08
    sauritas
    0

    Thanks for the reply! I didn't know that function in the menu bar...

     

    My second problem is solved... I just was running an old uForum dll (the one without administration extensions)... but I can't solve my first problem... everything seems to be ok...I'll keep trying.

    uForum seems to work ok, but I don't like to have xslt errors...

     

    Thanks!!!

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Sep 14, 2010 @ 23:09
    Morten Bock
    0

    Just to clarify. Are you only seeing these errors when saving the file, or at runtime as well?

  • sauritas 37 posts 57 karma points
    Sep 14, 2010 @ 23:20
    sauritas
    0

    The second one is solved. But the first one, only appear when saving the file... so I check the Hide Errors checkbox...

Please Sign in or register to post replies

Write your reply to:

Draft