BizTalk XSLT Map - Execution of scripts was prohibited

Lorenzo 21 Reputation points
2021-05-27T10:02:04.897+00:00

I'm programming with BizTalk Server 2020 (Visual Studio 2019).

I have this xsl code (simplified), that is in an external xsl file of a btm map:

<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
    xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" 
    exclude-result-prefixes="msxsl var userCSharp" version="1.0" 
    xmlns:ns0="http://Schema1/EDI/EDIFACT/2006" 
    xmlns:ns1="http://Schema2.schCanonical" 
    xmlns:userCSharp="http://schemas.microsoft.com/BizTalk/2003/userCSharp">

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

  <xsl:template match="/">
    <xsl:apply-templates select="/ns0:EFACT"/>
  </xsl:template>

  <xsl:template match="/ns0:EFACT">
    <ns1:schCanonical>
      <xsl:variable name="var:v1" select="userCSharp:StringConcat(&quot;VariableOne&quot;)"/>
      ...
    </ns1:schCanonical>
  </xsl:template>

  <msxsl:script language="C#" implements-prefix="userCSharp">
      <! [CDATA[     // this is written whitout space between ! and [
      public string StringConcat(string param0)
      {
        return param0;
      }
      ]]>
  </msxsl:script>
</xsl:stylesheet>

The problem is that on var:v1 declaration I have this warning:

Execution of scripts was prohibited. Use the XsltSettings.EnableScript property to enable it.

These are BTM GRID configurations:

  • Custom Extension XML: "externalObject.xml"
  • Custom XSLT Path: "xsl file with above code"
  • XSLT Trasform engine: Undefined

The externalObject.xml code is:

<ExtensionObjects/>

This is the error:

SjwHN.png

Emr2z.png

When I test the map, warnings are displayed for each script call, vice versa no tests have been performed with the deploy yet. I would like to solve the problem to have a "clean" solution. Some xsl files are complex, so I see the sheet full of warnings, and even the console when I test the maps.

My fear is that if I were to implement other functions, this error could affect the correct transformation output.

How can I fix it?

Microsoft BizTalk Server
Microsoft BizTalk Server
A family of Microsoft server products that support large-scale implementation management of enterprise application integration processes.
349 questions
0 comments No comments
{count} votes