This project is read-only.

mdo:net maximum parameters?

Jan 18, 2011 at 2:03 PM

with a custom dll with 8 params i get a error urn:mdo does not contain a matching net method that has 8 parameters

The same with 7 parameters is working. Also counting the PortalID

Version 2.0.39

Jan 18, 2011 at 2:09 PM

with 9 or 10 i also get it.

Jan 18, 2011 at 2:23 PM

found it, helper.cs has only 6 parameters. i'll upgrade my local developement system to allow more parameters, but i think there need to be a more advanced fix. Like counting the number of parameters and then giving the correct number to the custom dll.

Coordinator
Jan 18, 2011 at 2:24 PM

Yes, this is a current limit.

As MS XSL Extensions can't be created with unlimited number of parameters, so I have to create something like following

 

        public object net(string proc, object p1, object p2, object p3, object p4, object p5, object p6)
        { return net(proc, new object[] { p1, p2, p3, p4, p5, p6 }); }
        public object netcall(string instance, string method, object p1, object p2, object p3, object p4, object p5, object p6)
        { return netcall(instance, method, new object[] { p1, p2, p3, p4, p5, p6 }); }

 

You can just find this code in ~/App_Code/XsltDb/Helper.cs and add more mappings with p7, p8, p9, ...

Next release I'll change limit to 12 parameters in main development branch.

Coordinator
Jan 18, 2011 at 2:25 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Jan 18, 2011 at 2:34 PM

One more thing... XsltDb supports safe development mode for poratl admins. they can access access only limited set of stored procedures (mdo:xml), only limited set of .NET API (mdo:net)

Actually, if you don't need to distingush super users and portal admins you can use msxsl:script tag and access you DLL without any restrictions.

http://xsltdb.codeplex.com/wikipage?title=server-side%20scripting

You only have to reference your assembly as

<msxsl:assembly name="YourAssembly" /> <!-- File name without DLL extension -->

Also see details here http://msdn.microsoft.com/library/ms256188.aspx

Jan 19, 2011 at 10:44 AM

my programing skill are not that high, can you give a example? Because i tried to repeat the microsoft method and it is not working for me.

Jan 19, 2011 at 12:43 PM

I've got this at the moment:

<msxsl:script language="C#" implements-prefix="script">
  <msxsl:assembly name="MADNN2CRM" />
  <msxsl:using namespace="Mdo.XsltDb" />
  public string test(PortalID, voornaam, achternaam, adres, postcode, plaats, tussenvoegsel, telefoon, email, salutation, huisnummer, huisnummertoevoeging, decaanaanhef, decaannaam, huidigeopleiding, klas)
  {
    return Helper.CreateNew(PortalID, voornaam, achternaam, adres, postcode, plaats, tussenvoegsel, telefoon, email, salutation, huisnummer, huisnummertoevoeging, decaanaanhef, decaannaam, huidigeopleiding, klas);
  }
</msxsl:script>

<xsl:template match="/">
  Result: <xsl:value-of select="script:test(1,'Martijn','Laar','bla bla','blabla','blabla','11','0123456789','blabla','1','1','a','1','blabla','1','1')"/>
</xsl:template>

when i run i get this error, i don't know where to find it?

System.Xml.Xsl.XslLoadException: Id wordt verwacht An error occurred at (0,0).
at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
at System.Xml.Xsl.XslCompiledTransform.Load(XmlReader stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
at Findy.XsltDb.Transformer.<>c__DisplayClass14.<TransformRelease>b__13()
at Findy.XsltDb.StaticCache2.Get(String key, Instantiator callback)
at Findy.XsltDb.Transformer.TransformRelease(String xml, String xsl, Helper h, String html, Boolean IsSuper)
at Findy.XsltDb.Transformer.JustTransform(String xsl, String xml, Boolean debug, Boolean IsSuper)
at Findy.XsltDb.Transformer.Transform(String xml, String xsl, Boolean IsSuper)
at Findy.XsltDb.ViewXsltDb.Page_Init(Object sender, EventArgs e) <!-- End_Module_385 -->

Coordinator
Jan 19, 2011 at 1:54 PM

1. Your problem is here:

  public string test(PortalID, voornaam, achternaam, adres, ...

you've forgotten types before parameter names ;)

2. An error occurred at (0,0) means position of XSL tag that causes the error. Here it is <msxsl:script>

3. I prepared a sample how you can attach a DLL to XsltDb:

3.1. Create a simple class and compile it into a DLL (Here we assume XsltDb.SamplePlugin.dll)

namespace XsltDb.SamplePlugin // can be anything you want
{
    public class MyPlugin
    {
        public static string SomePluginMethod(string p1, string p2)
        {
            return p1 + " " + p2;
        }
    }
}

3.2. Put XsltDb.SamplePlugin.dll into site's bin folder

3.3. Create the following config

<msxsl:script language="C#" implements-prefix="script">
  <msxsl:assembly name="XsltDb.SamplePlugin"/>
  <msxsl:using namespace="XsltDb.SamplePlugin"/>
  
  public string plg(string first, string second)
  {
      return  MyPlugin.SomePluginMethod(first, second);
  }

</msxsl:script>

<xsl:template match="/">
  <xsl:value-of select="script:plg('Hello', 'World')"/>
</xsl:template>

HTH