BizTalk Map Issue: Multiple Error Blocks Appearing Unexpectedly

anukul harry 0 Reputation points
2025-11-14T17:41:06.5233333+00:00

<?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:userCsharp="http://schemas.microsoft.com/BizTalk/2003/userCSharp"

            version="1.0">

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

<!-- Main Template -->

<xsl:template match="/">

<RootOutput>

  <!-- ============================== -->

  <!-- SECTION 1: HEADER INFORMATION  -->

  <!-- ============================== -->

  <Header>

    <SourceSystem>BizTalkDemoSystem</SourceSystem>

    <TargetSystem>ExternalProcessingUnit</TargetSystem>

    <GeneratedOn>

      <xsl:value-of select="userCsharp:getCurrentDateTime()"/>

    </GeneratedOn>

  </Header>

  <!-- ===================================================== -->

  <!-- SECTION 2: INPUT SUMMARY (Example transformation)     -->

  <!-- ===================================================== -->

  <InputSummary>

    <ItemCount>

      <xsl:value-of select="count(/*/*)"/>

    </ItemCount>

    <DocumentType>StandardProcessing</DocumentType>

    <Status>Received</Status>  
      error : 18883518503

  </InputSummary>

  <!-- ============================== -->

  <!-- ERROR BLOCK #1                 -->

  <!-- ============================== -->

  <ProcessingErrors>

    <Error>

      <Code>18883518503</Code>

      <Location>Stage: Validation</Location>

      <Message>Input schema validation failed for one or more nodes.</Message>

    </Error>

  </ProcessingErrors>

  <!-- ============================================ -->

  <!-- SECTION 3: TRANSFORMATION OF INPUT ITEMS     -->

  <!-- ============================================ -->

  <ProcessedItems>

    <xsl:for-each select="/*/*">

      <Item>

        <Index>

          <xsl:value-of select="position()"/>

        </Index>

        <OriginalValue>

          <xsl:value-of select="."/>

        </OriginalValue>

        <TransformedValue>

          <xsl:value-of select="userCsharp:ToUpper(.)"/>

        </TransformedValue>

        <IsNumber>

          <xsl:value-of select="userCsharp:isNumeric(.)"/>

        </IsNumber>

      </Item>

    </xsl:for-each>

  </ProcessedItems>

  <!-- ============================== -->

  <!-- ERROR BLOCK #2                 -->

  <!-- ============================== -->

  <TransformationErrors>

    <Error>

      <Code>18883518503</Code>

      <Location>Stage: Transformation</Location>

      <Message>Unexpected null or empty node encountered during mapping.</Message>

    </Error>

  </TransformationErrors>

  <!-- ============================================= -->

  <!-- SECTION 4: ADVANCED CALCULATIONS (EXAMPLE)    -->

  <!-- ============================================= -->

  <AdvancedSection>

    <Totals>

      <TotalNumericItems>

        <xsl:value-of select="userCsharp:countNumeric(/*/*)"/>

      </TotalNumericItems>

      <TotalLength>

        <xsl:value-of select="userCsharp:getTotalLength(/*/*)"/>

      </TotalLength>

    </Totals>

    <Statistics>

      <AverageLength>

        <xsl:value-of select="userCsharp:getAverageLength(/*/*)"/>

      </AverageLength>

      <LongestValue>

        <xsl:value-of select="userCsharp:getLongest(/*/*)"/>

      </LongestValue>

    </Statistics>

  </AdvancedSection>

  <!-- ============================== -->

  <!-- ERROR BLOCK #3                 -->

  <!-- ============================== -->

  <CalculationErrors>

    <Error>

      <Code>18883518503</Code>

      <Location>Stage: Statistics</Location>

      <Message>Division by zero encountered while calculating averages.</Message>

    </Error>

  </CalculationErrors>

  <!-- ====================================================== -->

  <!-- SECTION 5: OUTPUT META INFORMATION                     -->

  <!-- ====================================================== -->

  <Metadata>

    <ProcessedOn>

      <xsl:value-of select="userCsharp:getCurrentDateTime()"/>

    </ProcessedOn>

    <ProcessedBy>BizTalkEngineCore</ProcessedBy>

    <Version>1.0.5</Version>

  </Metadata>

  <!-- ============================== -->

  <!-- ERROR BLOCK #4                 -->

  <!-- ============================== -->

  <SystemErrors>

    <Error>

      <Code>18883518503</Code>

      <Location>Stage: SystemAccess</Location>

      <Message>Unable to read auxiliary configuration settings.</Message>

    </Error>

  </SystemErrors>

  <!-- ============================== -->

  <!-- ERROR BLOCK #5                 -->

  <!-- ============================== -->

  <FinalErrors>

    <Error>

      <Code>18883518503</Code>

      <Location>Stage: Finalization</Location>

      <Message>Output serialization warning occurred.</Message>

    </Error>

  </FinalErrors>

</RootOutput>

</xsl:template>

<!-- ============================================ -->

<!-- USER C# EXTENSIONS: Used by BizTalk Maps -->

<!-- ============================================ -->

<msxsl:script language="C#" implements-prefix="userCsharp"><![CDATA[

using System;

using System.Xml;

public string getCurrentDateTime()

{

    return DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss");

}

public string ToUpper(string value)

{

    if (value == null) return "";

    return value.ToUpper();

}

public string isNumeric(string value)

{

    double d;

    return Double.TryParse(value, out d) ? "true" : "false";

}

public string countNumeric(XmlNodeList nodes)

{

    int count = 0;

    double num;

    foreach (XmlNode n in nodes)

    {

        if (Double.TryParse(n.InnerText, out num))

            count++;

    }

    return count.ToString();

}

public string getTotalLength(XmlNodeList nodes)

{

    int total = 0;

    foreach (XmlNode n in nodes)

    {

        total += n.InnerText.Length;

    }

    return total.ToString();

}

public string getAverageLength(XmlNodeList nodes)

{

    if (nodes.Count == 0) return "0";

    int total = 0;

    foreach (XmlNode n in nodes)

        total += n.InnerText.Length;

    return (total / nodes.Count).ToString();

}

public string getLongest(XmlNodeList nodes)

{

    string longest = "";

    foreach (XmlNode n in nodes)

    {

        if (n.InnerText.Length > longest.Length)

            longest = n.InnerText;

    }

    return longest;

}

]]></msxsl:script>

</xsl:stylesheet>

BizTalk Server
BizTalk Server

A family of Microsoft server products that support large-scale implementation management of enterprise application integration processes.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.