Copied to clipboard

Flag this post as spam?

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


  • ID 27 posts 128 karma points
    Apr 03, 2013 @ 14:25
    ID
    0

    Umbraco 6.0.3 gives error on RestContourExample.xslt

    Hi,

    I'm trying to get contour working with ajax. After trying a lot, now I wanted to give the RestContour a try.

    Unfortunately i'm not able to get the RestContourExample working on Umbraco 6.0.3 (Both Webforms and Mvc) due to the error (Error parsing XSLT file: \xslt\RestContourExample.xslt):

     

    System.Xml.Xsl.XslTransformException was unhandled by user code
      HResult=-2146231998
      Message=An error occurred during a call to extension function 'BuildForm'. See InnerException for a complete description of the error.
      Source=System.Data.SqlXml
      LineNumber=0
      LinePosition=0
      StackTrace:
           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.<xsl:template match="/">(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 C:\Development\MvcApplication3\MvcApplication3\xslt\RestContourExample.xslt:line 64
           at System.Xml.Xsl.CompiledQuery.Query.<xsl:apply-templates>(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, 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.GetXsltTransformResult(XmlDocument macroXML, XslCompiledTransform xslt)
           at umbraco.macro.LoadMacroXslt(macro macro, MacroModel model, Hashtable pageElements, Boolean throwError)
      InnerException: System.NullReferenceException
           HResult=-2147467261
           Message=Object reference not set to an instance of an object.
           Source=Umbraco.Forms.Core
           StackTrace:
                at Umbraco.Forms.Core.Form.get_AllFields()
                at Cultiv.RestContour.XsltExtensions.GetValidationRules()
                at Cultiv.RestContour.XsltExtensions.BuildForm()
           InnerException: 
    

    This is the call at line 57 of the RestContourExample.xslt (on rc:BuildForm()) :

        <script type="text/javascript">
          <xsl:text>jQuery(document).ready(function () {</xsl:text>
          <xsl:value-of select="rc:BuildForm()"/>
          <xsl:text>});</xsl:text>
        </script>

    I have tried with the folowing configurations but same result (all umbraco 6.0.3 and contour 3.0.9) on my Windows 7 machine (using the default IISExpress used by Visual studio & Webmatrix):

     

    1. NuGet installation on Visual Studio 2012 with Mvc 4 (.NET 4.5).
    2. WebMatrix with umbraco 6.0.3 Webforms.
    3. WebMatrix with umbraco 6.0.3 Mvc.

     

  • Jan Skovgaard 11244 posts 23437 karma points MVP 6x admin c-trib
    Apr 03, 2013 @ 22:24
    Jan Skovgaard
    0

    Hi ID

    Could you please try and post the content of the xslt file in here? From the error description above it looks like a namespace has possibly been set twice. But I would like to see the code to be sure.

    Cheers,
    Jan 

  • ID 27 posts 128 karma points
    Apr 04, 2013 @ 15:51
    ID
    0

    It's just the file which is included in the zip file --> RestContourPreview_0.8.0.zip

    but for your sake, here it is ;-)

    <?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:umbraco.contour="urn:umbraco.contour"

      xmlns:cultiv.restcontour="urn:cultiv.restcontour"

      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets umbraco.contour cultiv.restcontour ">

     

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

     

      <xsl:param name="currentPage"/>

     

      <xsl:template match="/">

        <xsl:variable name="setFormGuid" select="cultiv.restcontour:SetContourGuid('f2cece78-1bd1-426a-89e6-65f4ac72a1d7')"/>

        <xsl:variable name="formGuid" select="cultiv.restcontour:GetContourGuid()"/>

     

        <form action="" method="post" id="form-{$formGuid}" name="qaForm">

          <ul class="formArea">

            <li>

              <label for="Name">Name:</label>

              <input type="text" name="Name"/>

            </li>

            <li>

              <label for="Email">E-mail:</label>

              <input type="text" name="Email"/>

            </li>

            <li>

              <label for="Message">Question:</label>

              <textarea name="Message">

                <xsl:text> </xsl:text>

              </textarea>

            </li>

            <li class="send-button">

              <input type="submit" value="Send" class="button" />

            </li>

            <li class="errorList">

              <ul class="errorList">

                <xsl:comment/>

              </ul>

            </li>

          </ul>

          <div class="formLoading hide">

            <h2>Processing</h2>

            <h4>The form is being sent</h4>

          </div>

          <div class="formPosted hide">

            <h2>Thanks</h2>

            <h4>We've successfully recieved the form, thanks!</h4>

          </div>

        </form>

     

        <script type="text/javascript">

          <xsl:text>jQuery(document).ready(function () {</xsl:text>

          <xsl:value-of select="cultiv.restcontour:BuildForm()"/>

          <xsl:text>});</xsl:text>

        </script>

     

        <xsl:variable name="setFormGuid2" select="cultiv.restcontour:SetContourGuid('b41c9cb7-6061-4b61-b335-879cf6cecae0')"/>

        <xsl:variable name="formGuid2" select="cultiv.restcontour:GetContourGuid()"/>

     

        <xsl:if test="count($currentPage/node) != 0">

          <xsl:for-each select="$currentPage/node">

            <h3>

              <xsl:value-of select="@nodeName"/>

            </h3>

            <p>

              <xsl:value-of select="data [@alias = 'answer']" disable-output-escaping="yes"/>

            </p>

          </xsl:for-each>

        </xsl:if>

     

        <form action="" method="post" id="form-{$formGuid2}" name="qaForm">

          <ul class="formArea">

            <li>

              <label for="Name">Naam:</label>

              <input type="text" name="Name" class="input-medium2 normalFields"/>

            </li>

            <li>

              <label for="Email">E-mail:</label>

              <input type="text" name="Email" class="input-medium2 normalFields" />

            </li>

            <li>

              <label for="Comment">Comment:</label>

              <textarea name="Comment" class="input-medium2 normalFields">

                <xsl:text> </xsl:text>

              </textarea>

            </li>

            <li class="send-button">

              <input type="submit" value="Send" class="button" />

            </li>

            <li class="errorList">

              <ul class="errorList">

                <xsl:comment/>

              </ul>

            </li>

          </ul>

          <div class="formLoading hide">

            <h2>Processing</h2>

            <h4>The form is being sent</h4>

          </div>

          <div class="formPosted hide">

            <h2>Thanks</h2>

            <h4>We've successfully recieved the form, thanks!</h4>

          </div>

        </form>

     

        <script type="text/javascript">

          <xsl:text>jQuery(document).ready(function () {</xsl:text>

          <xsl:value-of select="cultiv.restcontour:BuildForm()"/>

          <xsl:text>});</xsl:text>

        </script>

     

      </xsl:template>

     

    </xsl:stylesheet>

  • Will Morrison 8 posts 29 karma points
    Apr 22, 2013 @ 07:12
    Will Morrison
    0

    Hi,

    I'm getting the same problem using Umbraco 4.7.1 

     Error parsing XSLT file: \xslt\RestContourExample.xslt):

    I fixed the first problem by updating the GUID - I can now see the example form.

    http://localhost:49933/?altTemplate=RestContourExample

    See Package README:  (I updated the GUID's and it worked)

    Finally, update both GUIDs in the RestContourExample.xslt to the new ones that you've just created (click on preview on each form to get the GUID in the address bar). The xslt file doesn't save correctly from within Umbraco, just check the "Skip testing (ignore errors)" checkbox, it's okay. 

    Go to yoursite.ext/?altTemplate=RestContourExample to test the forms.

     

    However, now I seem to have a second problem. interestingly I was getting the responses correctly from the Cultiv RestContour package when hitting:

    http://localhost:49933/base/getContourForm/GetFormFields/?formGuid=9bb96784-1fe0-4da0-8283-306eb800101e

    But now (after installing the "example" package) all I get is this:  (anyone have any ideas?)

    This XML file does not appear to have any style information associated with it. The document tree is shown below.
    <error>
    <![CDATA[
    MESSAGE: Exception has been thrown by the target of an invocation. STACKTRACE: at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at umbraco.presentation.umbracobase.requestModule.invokeMethod(restExtension myExtension, Object[] paras) INNEREXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=3.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified. File name: 'Newtonsoft.Json, Version=3.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' at Cultiv.RestContour.Helper.GetJsonForObject(Object object) at Cultiv.RestContour.Helper.GetFormFields(String formGuid, String stringType) at Cultiv.RestContour.GetContourForm.GetFormFields() WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
    ]]>
    </error>
    I think the important part is: Could not load file or assembly 'Newtonsoft.Json
  • Will Morrison 8 posts 29 karma points
    Apr 23, 2013 @ 07:15
    Will Morrison
    0

    Hey, I solved it - the Cultiv.RestContour.dll is an older one which gets installed with the "Rest Contour Preview" Package.  So if you installed the Preview after the Cultiv Rest Contour package (as I did) then the .dll gets overwritten.

    It looks like the Preview and the actual package contain references to different versions of the Json.NET package, which fails depending on which dll you have and which one you're trying to use.  Anyways, to fix it, just grab the .dll out of the main (2.02) Cultiv Rest Contour Package, and copy it overtop the one that the Preview put in there.  (Preview Form will stop working, and give this XSLT message that you showed above)

     

    So Preview Package - (old .dll)

    Cultiv Package - (new dll)

     

    It sounds like you did things in the reverse order that I did, so you probably have the (new) one, thus the preview package doesn't work.

Please Sign in or register to post replies

Write your reply to:

Draft