.netxmlxslt-1.0.net-core-2.1

platformnotsupportedexception : XSLCompiledTransform.Load(xslt) not loading the xslt file with </msxsl:script> in .net Core 2.1 target framework


I have a xml file which i need to convert to txt, for which i used xslt transformation. My xslt transform file contains some supporting javascript functions in

I could successfully transform the file if i run my code in .net framework 4.5 and above but same code fails with .net core 2.1.

Documentation of .netcore 2.1 shows support for xslt transformation, but its not working for me, is that anything I am missing.

My Input XML:

   <?xml version="1.0" encoding="utf-8"?>
<Maps xmlns:xsi= "https://www.w3.org/TR/xmlschema-1/" xmlns:xsd= "http://www.w3.org/2001/XMLSchema" xmlns= "http://www.semi.org">
<Map SubstrateId= "EMAXA191X0121" SubstrateType= "">
<Device MachineID= "M/C Name : AOI-404" BinType= "Decimal" NullBin= "099" Orientation= "0" OriginLocation= "2" Columns= "59" Rows= "41" CreateDate= "20190111.214309" ProductId= "EMAXA191X0121" LotId= "" WaferSize= "200">
<ReferenceDevice ReferenceDeviceX= "-1" ReferenceDeviceY= "-1" />
<Bin>
<Bin BinCode= "001" BinCount= "1565" BinQuality= "Pass" />
<Bin BinCode= "061" BinCount= "657" BinQuality= "Fail" />
<Bin BinCode= "062" BinCount= "11" BinQuality= "Fail" />
<Bin BinCode= "064" BinCount= "9" BinQuality= "Fail" />
<Bin BinCode= "065" BinCount= "1" BinQuality= "Fail" />
<Bin BinCode= "069" BinCount= "143" BinQuality= "Fail" />
</Bin>
<Data MapName= "MMI G85" Version= "1.0">
<Row> <![CDATA[061 001 061 061 001 061 061 001 061 061 001 061 061 069 061 061 001 061 061 061 061 061 061 001 061 001 061 061 099 099 099 001 001 061 001 061 061 001 001 001 001 001 061 001 001 001 001 001 061 001 061 001 001 061 061 001 061 061 061]]> </Row>
<Row> <![CDATA[061 001 061 061 001 061 001 001 061 061 061 061 061 001 061 061 061 061 061 061 061 061 061 061 061 061 061 061 001 061 061 061 061 001 061 069 001 001 001 001 001 061 061 001 001 001 001 001 061 001 001 061 001 001 061 061 061 061 061]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 001 001 001 061 001 001 001 001 001 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 001 061 061 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 061 061 061]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 001 001 001 001 001 061 001 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 001 061 069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 061 061 061]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 069 001 001 001 001 001 001 001 001 001 001 001 061 061 061 061 061 061 061 061 061 061 061 061 061 061 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 061 001 001 001 061 001 061 001 069 061 061 061]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 069 061 061 061 061 061 061 061 061 001 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 001 001 061 001 001 001 001 001 001 001 001 001 001 061 061 061 001 001 001 001 001 001 061 061 061 061]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 001 061 001 001 001 001 061 001 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 001 061 061 001 061 061 001 001 069 001 061 061 061 001 061 069 001 061 001 061 061 001 001 061 001 061 061 061]]> </Row>
<Row> <![CDATA[069 001 061 001 001 001 001 061 001 001 001 001 001 001 001 061 061 061 061 001 061 061 001 001 001 001 001 001 001 069 001 001 001 069 001 069 001 001 001 001 001 069 001 069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 001 001 001 001 001 001 001 001 061 001 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 001 061 061 001 061 001 061 061 001 061 001 069 001 061 001 001 061 061 001 061 001 001 001 001 001 061 061 061]]> </Row>
<Row> <![CDATA[061 061 001 061 001 001 061 001 001 061 001 001 001 001 061 001 001 061 061 061 061 061 061 061 061 061 061 061 061 061 061 001 061 061 001 061 069 001 001 001 001 001 001 069 061 061 001 061 061 001 001 061 001 001 001 061 061 061 001]]> </Row>
<Row> <![CDATA[069 001 001 001 001 061 001 001 061 001 001 001 061 061 061 001 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 001 061 061 001 061 001 001 001 001 061 001 061 001 069 001 061 001 061 001 001 001 001 061 001 001 001 001 061]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 069 001 001 001 001 001 001 001 001 001 001 069 001 001 001 069 001 001 001 001 001 001 069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 061 061 061]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 001 001 001 069 001 001 001 001 001 001 001 061 061 061 061 001 061 061 001 061 061 061 001 061 001 001 061 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 061 001 001 001 001 001 001 001 001 061]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 061 061 001 061 061 061 061 061 061 061 061 001 061 061 061 061 061 001 001 001 001 001 061 001 061 001 001 001 061 061 001 001 061 001 001 061 001 001 001 001 061 061]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 061 001 001 001 001 061 001 001 001 001 001 001 069 001 001 001 001 001 001 001 001 001 069 001 069 001 001 001 001 001 001 001 001 001 001 001 061 001 001 001 001 001 001 001 001 001 001 069 001 069 069 069 001]]> </Row>
<Row> <![CDATA[001 001 001 001 001 001 001 001 001 001 001 061 001 001 001 001 001 001 069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 069 001 001 001 001 001 061 001 061 001 001 001 001 001 001 001 069 069 061 001 061 001 001]]> </Row>
<Row> <![CDATA[069 001 001 001 061 061 001 001 001 061 001 061 001 001 061 001 001 001 069 001 001 001 001 001 001 001 001 001 001 069 001 001 001 001 001 001 001 001 061 001 001 001 001 061 061 001 001 001 001 001 001 001 001 001 001 001 001 069 069]]> </Row>
<Row> <![CDATA[061 001 001 001 001 061 001 001 001 001 001 001 001 001 001 001 001 069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 061 001 001 001 001 001 001 001 001 001 001 001 001 001 061 061 061]]> </Row>
<Row> <![CDATA[069 061 001 001 001 001 001 061 001 001 001 001 001 001 001 001 061 001 061 061 001 001 001 061 061 061 061 061 061 069 061 001 061 061 001 061 001 001 061 061 061 061 001 061 061 001 061 001 061 001 001 061 001 001 001 001 061 061 061]]> </Row>
<Row> <![CDATA[069 001 001 001 061 061 061 001 061 001 001 061 061 001 001 001 061 001 061 001 061 061 061 061 061 061 061 061 099 099 099 001 061 001 001 061 001 001 061 061 061 001 061 061 061 001 061 061 001 069 061 001 069 001 061 069 061 061 061]]> </Row>
<Row> <![CDATA[099 099 099 099 001 001 099 099 099 099 099 001 061 061 061 061 061 001 061 061 061 061 061 061 001 061 061 061 099 099 099 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 001 099 099 099 099 099 001 061 099 099 099 099]]> </Row>
<Row> <![CDATA[061 061 061 061 061 061 061 001 061 001 061 061 061 061 061 001 061 061 061 061 061 061 061 061 061 061 061 061 099 099 099 061 061 061 061 061 001 001 001 061 061 001 061 061 061 061 061 001 061 061 001 061 061 001 061 001 061 061 069]]> </Row>
<Row> <![CDATA[061 061 061 001 061 061 061 061 061 061 001 061 061 061 061 001 061 061 061 001 001 001 001 061 061 001 061 061 061 061 001 001 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 001 061 001 061 061 061]]> </Row>
<Row> <![CDATA[061 001 061 001 001 061 061 061 001 061 061 061 061 001 061 001 061 061 061 061 061 061 061 061 061 061 061 061 061 061 061 001 061 061 061 061 001 061 061 061 061 061 061 061 061 001 061 061 061 061 061 061 061 061 061 061 001 061 061]]> </Row>
<Row> <![CDATA[001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 069 001 001 001 001 001 001 061 061 001 001 001 069 061 001 001 001 001 001 001 001 001 001 001 061 061 061 061 061 001 069 001 001 001 001 061 001 001 061 001 069 069 001]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 069 001 069 001 001 065 001 001 001 001 001 001 069 069 001 001 069 001 001 001 001 001 001 069 061 001 001 001 001 001 069 001 001 001 001 001 001 001 001 001 001 001 069]]> </Row>
<Row> <![CDATA[001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 069 069 001 001 001 001 001 061 001 061 061 069 001 001 001 061 001 001 001 001 001 001 001 001 001 061 061 061 001 001 001 001 001 001 001 001 001 001 001 061 001 001]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 001 001 061 001 001 001 061 001 001 001 001 069 061 001 001 001 001 001 001 001 001 001 001 069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 061 001 001 001 001 061 061 061 069 001]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 061 069 001 001 001 001 001 001 001 001 001 001 001 001 001 061 001 001 001 001 001 001 001 061 001 001 061 061 001 061 061 061 001 001 001 061 001 061 001 061 001 069]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 001 001 001 001 001 001 061 001 001 001 061 061 061 001 001 001 061 001 001 061 001 001 001 061 069 001 001 001 001 001 001 001 001 001 001 061 061 001 001 001 001 001 001 061 001 001 001 001 001 061 069 069 001]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 061 001 001 001 001 061 001 069 001 001 001 001 061 069 001]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 061 001 069 001 061 001 001 001 001 061 001 061 061 001 001 001 061 061 001 061 001 001 061 001 061 069 061 001 061 001 001 001 001 001 001 001 001 001 001 001 001 001 001]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 069 001 001 001 001 001 001 001 001 001 001 069 001 001 001 001 001 001 001 001 001 069 001 001 001 069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 069 001 001 001 001 001 001 001 001 001 069 069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 069 069 001 001 001 001 001 001 001 001 001 069 069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 069 001 001 001 001 001 001 001 001 001 001 069 069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 069 001 061 061 001 001 001 001 001 001 069 001 001 001]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 069 001 001 001 001 001 001 001 001 001 069 069 001 069 001 001 001 001 069 001 001 069 001 001 001 001 001 001 001 069 001 001 001 001 001 001 001 001 001 001 001]]> </Row>
<Row> <![CDATA[069 001 001 069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 061 001 001 001 001 069 001 001 001 001 001 001 061 069 001]]> </Row>
<Row> <![CDATA[069 069 001 069 001 001 001 001 001 001 001 001 001 001 001 001 001 069 069 001 001 001 001 001 001 001 001 001 001 069 001 001 001 001 001 001 001 069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 061 061 069 069 069]]> </Row>
<Row> <![CDATA[069 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 069 001 001 001 001 001 001 001 001 001 001 001 069 001 001 001 001 001 001 001 001 001 001 064 062 062 062 062 064 064 064 062 062 062 062 064 064 001 001 001 001 001]]> </Row>
<Row> <![CDATA[001 001 069 001 001 069 001 001 001 001 001 001 001 001 001 001 001 069 069 001 001 001 001 001 001 001 001 001 099 099 099 001 001 001 001 001 001 062 062 064 001 001 001 001 001 001 001 001 001 001 001 001 001 001 064 062 064 001 061]]> </Row>
</Data>
</Device>
</Map>
</Maps>

My XSLT designed for Transformation:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" 
                xmlns:xsi= "https://www.w3.org/TR/xmlschema-1/" 
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                xmlns= "http://www.semi.org"
                xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
                xmlns:outlet = "http://my.functions">



  <msxsl:script implements-prefix="outlet" language="javascript">
    <![CDATA[
    //script to replace string as XSLT1.0 doesnot support replace()
    function replace_str(str_text,str_by)
    {
    return str_text.replace(str_text,str_by);
    }

    //script to find the incoming bin code and idendify if pass/fail/null
    function identify_bin_type(available_bin_codes,search_string) {

    while(available_bin_codes.MoveNext()) {


    var current_bin_code = available_bin_codes.Current.Value;
    if ( current_bin_code === search_string){
    return current_bin_code;
    }
    }
    return "";
    }
    ]]>


  </msxsl:script>

  <xsl:strip-space elements="*"/>

  <!--variable section-->
  <xsl:variable name="Company_Name" select="'xxx'"/>
  <xsl:variable name="Notch_Direction" select="'DOWN'"/>
  <xsl:variable name="Device_Name" select="'EMAX-00'"/>
  <xsl:variable name="Pass_Bin_ASE_Code" select="'1'"/>
  <xsl:variable name="Fail_Bin_ASE_Code" select="'0'"/>
  <xsl:variable name="Null_Bin_ASE_Code" select="'X'"/>
  <xsl:variable name="Miss_Bin_ASE_Code" select="'0'"/>

  <xsl:variable name="Machine_Id" select="/node()[1]/node()[1]/node()[1]/@MachineID"/>

  <xsl:variable name="Wafer_Id" select="/node()[1]/node()[1]/@SubstrateId"/>

  <xsl:variable name="Bin1_Count" select="/node()[1]/node()[1]/node()[1]/node()[2]/*[@BinCode='001']/@BinCount"/>

  <xsl:variable name="Column_Value" select="/node()[1]/node()[1]/node()[1]/@Columns"/>
  <xsl:variable name="Row_Value" select="/node()[1]/node()[1]/node()[1]/@Rows"/>

  <xsl:variable name="Actual_Die_Nos" select="number($Column_Value) * number($Row_Value)"/>

  <xsl:variable name="Total_Die_Nos" select="sum(/node()[1]/node()[1]/node()[1]/node()[2]/*[@BinCount]/@BinCount)"/>

  <xsl:variable name="Device_Rows" select="/node()[1]/node()[1]/node()[1]/node()[3]/*/text()"/>

  <xsl:variable name="Pass_Bin_Codes" select="/node()[1]/node()[1]/node()[1]/node()[2]/*[@BinQuality='Pass']/@BinCode"/>
  <xsl:variable name="Fail_Bin_Codes" select="/node()[1]/node()[1]/node()[1]/node()[2]/*[@BinQuality='Fail']/@BinCode"/>
  <!--<xsl:variable name="Null_Bin_Codes" select="/node()[1]/node()[1]/node()[1]/node()[2]/*[@BinQuality='Null']/@BinCode"/>-->
  <xsl:variable name="Null_Bin_Codes" select="/node()[1]/node()[1]/node()[1]/@NullBin"/>


  <xsl:output method="text"  indent="yes"/>

  <!--Transpose template called for each Device Row Data-->
  <xsl:template name="find-identify-substitute-bincodes">
    <xsl:param name="string"/>

    <xsl:variable name="relevantSringLen" select="string-length($string)" />


    <xsl:if test="$relevantSringLen &gt; 1">
      <xsl:variable name="relevant-part" select="substring-before(substring-after($string,' '),' ')"/>



      <xsl:choose>

        <!--Check if it a pass bin code and replace with respective pass ASE Code-->
        <xsl:when test="contains(outlet:identify_bin_type($Pass_Bin_Codes,$relevant-part),$relevant-part)">

              <xsl:variable name="transform-relevant-part" select="outlet:replace_str($relevant-part,$Pass_Bin_ASE_Code)" />
              <xsl:value-of select="normalize-space(concat($transform-relevant-part,' '))"/>

        </xsl:when>


        <!--Check if it a fail bin code and replace with respective fail ASE Code-->

        <xsl:when test="contains(outlet:identify_bin_type($Fail_Bin_Codes,$relevant-part),$relevant-part)">

          <xsl:variable name="transform-relevant-part" select="outlet:replace_str($relevant-part,$Fail_Bin_ASE_Code)" />
          <xsl:value-of select="normalize-space(concat($transform-relevant-part,' '))"/>

        </xsl:when>



        <!--Check if it a null bin code and replace with respective null ASE Code-->

        <xsl:when test="contains(outlet:identify_bin_type($Null_Bin_Codes,$relevant-part),$relevant-part)">


              <xsl:variable name="transform-relevant-part" select="outlet:replace_str($relevant-part,$Null_Bin_ASE_Code)" />
              <xsl:value-of select="normalize-space(concat($transform-relevant-part,' '))"/>        

        </xsl:when>

        <!--Check if bin code not found and replace with respective miss ASE Code-->
        <xsl:otherwise>

          <xsl:variable name="transform-relevant-part" select="outlet:replace_str($relevant-part,$Miss_Bin_ASE_Code)" />
          <xsl:value-of select="normalize-space(concat($transform-relevant-part,' '))"/>


        </xsl:otherwise>
      </xsl:choose>

      <!--recursively look into the remainder string in the row and continue serch and replace till the end-->
      <xsl:variable name="remainder" select="substring-after($string,$relevant-part)"/>

      <xsl:call-template name="find-identify-substitute-bincodes">
        <xsl:with-param name="string" select="$remainder"/>
      </xsl:call-template>


    </xsl:if>

  </xsl:template>

  <!--Template of Device Data Rows to be called in main Template-->
  <xsl:template name="Devicedatarow">
    <xsl:for-each select="$Device_Rows">

      <xsl:variable name="Device_Row" select="current()"/>
      <xsl:variable name="Device_Row_Position" select="position()"/>


      <xsl:call-template name="find-identify-substitute-bincodes">
        <xsl:with-param name="string" select="$Device_Row" />

      </xsl:call-template>
      <xsl:text>&#xd;</xsl:text>
    </xsl:for-each>
  </xsl:template>

  <!--Main Text Template body-->
  <xsl:template match="/|@*">

    <xsl:text>Company Name: </xsl:text> 
    <xsl:value-of select="$Company_Name" />
    <xsl:text>&#xd;</xsl:text>

    <xsl:text>Device: </xsl:text>
    <xsl:value-of select="$Device_Name" />
    <xsl:text>&#xd;</xsl:text>

    <xsl:text>MachineID :</xsl:text>
    <xsl:value-of select="substring-after($Machine_Id, 'M/C Name :')" />

    <xsl:text>&#xd;</xsl:text>
    <xsl:text>Wafer ID: </xsl:text>
    <xsl:value-of select="$Wafer_Id" />

    <xsl:text>&#xd;</xsl:text>
    <xsl:text>BIN 1: </xsl:text>
    <xsl:value-of select="$Bin1_Count" />

    <xsl:text>&#xd;</xsl:text>
    <xsl:text>Total Die: </xsl:text>
    <xsl:value-of select="$Total_Die_Nos" />

    <xsl:text>&#xd;</xsl:text>
    <xsl:text>Notch Direction: </xsl:text>
    <xsl:value-of select="$Notch_Direction" />
    <xsl:text>&#xd;</xsl:text>

    <xsl:value-of select="concat('Column : ', $Column_Value, ', ' , ' Row : ', $Row_Value)" />
    <xsl:text>&#xd;</xsl:text>

    <xsl:text>Empty :</xsl:text>

    <xsl:text>&#xd;</xsl:text>
    <xsl:text>.............................................</xsl:text>
    <xsl:text>&#xd;</xsl:text>

    <xsl:call-template name="Devicedatarow">
    </xsl:call-template>

  </xsl:template>



</xsl:stylesheet>

My Expected Output:

Company Name: xxx
Device: EMAX-00
MachineID : AOI-404
Wafer ID: EMAXA191X0121
BIN 1: 1565
Total Die: 2386
Notch Direction: DOWN
Column : 59,  Row : 41
Empty :
.............................................
0100100100100000100000010100XXX1101001111101111101011001000
01001011000001000000000000001000010011111001111101101100000
01111111101111100000000000000001001111111111111111111111000
01111111111010000000000000000001001111111111111111111111000
01111101111111111100000000000000111111111111111011101010000
01111100000000010000000000000000011011111111110001111110000
01111110111101000000000000000001001001101000100101001101000
01011110111111100001001111111011101011111010111111111111111
01111111111111010000000000000001001010010101011001011111000
00101101101111011000000000000001001001111110001001101110001
01111011011100010000000000000001001011110101010101111011110
01111111111111111101111111111011101111110111111111111111000
01111111101111111000010010001011011111111111111110111111110
01111111111111111001000000001000001111101011100110110111100
01111101111011111101111111110101111111111101111111111010001
11111111111011111101111111111111111101111101011111110001011
01110011101011011101111111111011111111011110011111111111100
01111011111111111011111111111111111111111101111111111111000
00111110111111110100111000000001001011000010010101101111000
0111000101100111010100000000XXX1011011000100010010010100000
XXXX11XXXXX10000010000001000XXX00000000000000001XXXXX10XXXX
0000000101000001000000000000XXX0000011100100000100100101000
00010000001000010001111001000011000000000000000000000101000
01011000100001010000000000000001000010000000010000000000100
11111111111111110111111001110011111111110000010111101101001
01111111111111110101101111110011011111100111110111111111110
11111111111111111001111101000111011111111100011111111111011
01111111011101111001111111111011111111111111111110111100001
01111111111111111001111111111111011111110110010001110101010
01111111111101110001110110111001111111111001111110111110001
01111111111111111011111111111111111111111111011110101111001
01111111111111110101011110100111001011010001011111111111111
01111111111111111101111111111011111111101110111111111111111
01111111111111111101111111110011111111111111111111111111111
01111111111111111001111111110011111111111111111111111111111
01111111111111111011111111110011111111111111101001111110111
01111111111111111101111111110010111101101111111011111111111
01101111111111111111111111111011111111111111011110111111001
00101111111111111001111111111011111110111111111111111100000
01111111111111111011111111111011111111110000000000000011111
1101101111111111100111111111XXX1111110001111111111111100010

My .net sample application to execute the transformation:

public static void RunXslt1(string currentInputXML,string currentOutputTXT,string transformxsltPath)
        {
            var fileInUse = "XSLT";
            try
            {
                Console.WriteLine(String.Format("starting XSLT process"));
                // Load the style sheet.
                var settings = new XsltSettings();
                settings.EnableScript = true;
                var xslt = new XslCompiledTransform();
                xslt.Load(transformxsltPath, settings, null);
                // Execute the transform and output the results to a file.
                fileInUse = "XML";
                xslt.Transform(currentInputXML, currentOutputTXT);
                Console.WriteLine(String.Format("Fail occurs on transformation."));
            }
            catch (FileNotFoundException ex)
            {
                if (fileInUse.Equals("XSLT"))
                {
                    Console.WriteLine("XSLT file not found.");
                    Environment.Exit(1);
                }
                else if (fileInUse.Equals("XML"))
                {
                    Console.WriteLine("XML file not found.");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Fail occurs on transformation. \nError : " + ex.Message);

            }
        }

This code prefectly works good in .net framework 4.6, but if i run it in .netCore 2.1 then the below point gets platformnotsupportexception

 xslt.Load(transformxsltPath, settings, null);

System.PlatformNotSupportedException: Compiling JScript/CSharp scripts is not supported

What is missing for .netCore 2.1? My xslt version is 1.0, Visual studio 2017,trarget Framework .netcore2.1 I have tried many suggestions, but nothing seemed to work Please assist me in this,


Solution

  • According to the dotnet corefx github repository, the feature is not supported in .NET Core and there are currently no plans to implement it. More details can be found here

    Unfortunately, it looks like your only option it to stick with .NET Framework for now.

    EDIT

    I do like a challenge so I've played around with your XSLT and found a solution that will run in .NET Core.

    We need to remove the JScript to get rid of that error. So we need to replace your JScript methods with XSLT methods.

    To remove replace-str I looked around and found an XSLT template that will do the string replace for you. This is the answer I used

    Add the template to your XSLT

    <xsl:template name="string-replace-all">
      <xsl:param name="text" />
      <xsl:param name="replace" />
      <xsl:param name="by" />
      <xsl:choose>
        <xsl:when test="contains($text, $replace)">
          <xsl:value-of select="substring-before($text,$replace)" />
          <xsl:value-of select="$by" />
          <xsl:call-template name="string-replace-all">
            <xsl:with-param name="text" select="substring-after($text,$replace)" />
            <xsl:with-param name="replace" select="$replace" />
            <xsl:with-param name="by" select="$by" />
          </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$text" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:template>
    

    and replace your replace_str calls with the example in the answer

    <xsl:variable name="transform-relevant-part">
      <xsl:call-template name="string-replace-all">
        <xsl:with-param name="text" select="$relevant-part" />
        <xsl:with-param name="replace" select="$relevant-part" />
        <xsl:with-param name="by" select="$Pass_Bin_ASE_Code" />
      </xsl:call-template>
    </xsl:variable>
    

    Now, your when clauses don't need the identify_bin_type JScript function to find any matches, you can use the XSLT contains method to find matches for you:

    <xsl:when test="contains($Pass_Bin_Codes, $relevant-part)">
    

    This should produce the required output.