0

Can someone help me to fix this error? I have a xsl file which have a in parameter a ObjectList. I want to get the compiled HTML from this XSL and then to generate a PDF (not important)

This is my xsl:

<?xml version="1.0" encoding="utf-8"?>

<xsl:output method="xml" indent="yes" />
<xsl:param name="test"></xsl:param>
<xsl:template match="/">
    <html>
        <body>
            <center>
                <p class="test">
                    <xsl:for-each select="$test">
                        <div>
                            <xsl:value-of select="description" />
                        </div>
                    </xsl:for-each>
      </p>
            </center>
        </body>
        <style>
    .test{color:red}

  </style>
    </html>
</xsl:template>

I give to this XSL a list with objects that have description as a string field.

This is my method that transforms the XLS into a html:

 public static string TransformXMLToHTML(string templatePath, XsltArgumentList argsList)
    {
        string htmlString = string.Empty;
        XslCompiledTransform transform = new XslCompiledTransform();

        var mappedPath = System.Web.Hosting.HostingEnvironment.MapPath(templatePath);
        transform.Load(mappedPath);

        StringWriter sw = new StringWriter();
        transform.Transform(new XmlDocument(), argsList, sw);
        htmlString = sw.ToString();
        return htmlString;

    }

This is how i call the method:

 XsltArgumentList pdfArgs = new XsltArgumentList();
 pdfArgs.AddParam("test", "", blob.Items);
  string html= HTMLFromXslt.TransformXMLToHTML("~/Templates/test.xslt", pdfArgs); ;

I receive this error:

'Extension function parameters or return values which have Clr type 'List`1' are not supported.

Thanks guys !

Michael Commons
  • 773
  • 2
  • 9
  • 28
  • [https://stackoverflow.com/questions/3046898/error-message-in-xslt-with-c-sharp-extension-function](https://stackoverflow.com/questions/3046898/error-message-in-xslt-with-c-sharp-extension-function) – Fratyx Mar 02 '18 at 09:12
  • Possible duplicate of [Error message in XSLT with C# extension function](https://stackoverflow.com/questions/3046898/error-message-in-xslt-with-c-sharp-extension-function) – Fildor Mar 02 '18 at 09:38

0 Answers0