BizTalk Map Custom External XSLT Error

Nov 26, 2008 at 3:29 PM

Note, the whole purpose of this map, for me at this time, is to experiment with using XSLT Extension Functions in an embedded script block, which I have learned about from an article in BizTalk HotRod, Issue 4, online magazine, titled "Smart Use of XSLT BizTalk," by Scott Colestock.

While developing a map in BizTalk to transform an XML input instance to a flat-file output instance, I get the following error:

Output Window Error Description:
error btm1048: Native serialization error: Name cannot begin with the '.' character, hexadecimal value 0x00. Line 1, position 40.

Error List Window Description:
Error 3 Native serialization error: Name cannot begin with the '.' character, hexadecimal value 0x00. Line 1, position 40.

Contents of Visual Studio generated temporary output file:
<?xml version="1.0" encoding="utf-8"?><ns1:ClientScenario xmlns:ns1="BizTalkMapTestsTest01.Schemas.OutputSchema1.ClientScenario"><Header><RecordType>HEADER</RecordType><FileDate>20081126083500</FileDate><AccountId>00041BUNCH FEES</AccountId><Filler></Filler></Header><Detail><BillDate>20081121130701</BillDate><EmployeeName>,</EmployeeName><ClaimNumber>1234567891</ClaimNumber></Detail><Detail><BillDate>20081121130702</BillDate><EmployeeName>,</EmployeeName><ClaimNumber>1234567892</ClaimNumber></Detail><Detail><BillDate>20081121130703</BillDate><EmployeeName>,</EmployeeName><ClaimNumber>1234567893</ClaimNumber></Detail><Trailer><RecordType>TRAILER</RecordType><FileDate>20081126085420</FileDate><RecordCount>3</RecordCount><Filler></Filler></Trailer></ns1:ClientScenario>

Note: Line 1, position 40, of the above file puts it at the "n" of the <ns1:ClientScenario> element, above.

Note, the external XSLT file is located in the same directory as the map. When I choose the Custom XSL Path property of the map, and browse to the XSLT file, the setting ends up being: .\NCMIExport_TO_GABNCMIExportMapStylesheet200811260926a.xsl, which, incidentally, has a period (.) for the reference to the XSLT file path name.

BizTalk map settings:
Custom Extension XmL: (blank)
Custom XSL Path: .\NCMIExport_TO_GABNCMIExportMapStylesheet200811260926a.xsl

Contents of TestMap Input Instance File:
<ns0:ClientScenario xmlns:ns0="BizTalkMapTestsTest01.Schemas.InputSchema1.ClientScenario">
  <SQLRecord>
    <CLAIMNUMBER>1234567891</CLAIMNUMBER>
    <BILLDATE>20081121130701</BILLDATE>
    <LASTNAME>Smith</LASTNAME>
    <FIRSTNAME>John</FIRSTNAME>
  </SQLRecord>
  <SQLRecord>
    <CLAIMNUMBER>1234567892</CLAIMNUMBER>
    <BILLDATE>20081121130702</BILLDATE>
    <LASTNAME>Rogers</LASTNAME>
    <FIRSTNAME>Bob</FIRSTNAME>
  </SQLRecord>
  <SQLRecord>
    <CLAIMNUMBER>1234567893</CLAIMNUMBER>
    <BILLDATE>20081121130703</BILLDATE>
    <LASTNAME>Atkins</LASTNAME>
    <FIRSTNAME>Susan</FIRSTNAME>
  </SQLRecord>
</ns0:ClientScenario>

Contents of External Stylesheet referred to using Custom XSLT Path:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:msxsl="urn:schemas-microsoft-com:xslt"
     xmlns:ext="urn:my-scripts"
     exclude-result-prefixes="ext msxsl"
     xmlns:ns0="BizTalkMapTestsTest01.Schemas.InputSchema1.ClientScenario"
     xmlns:ns1="BizTalkMapTestsTest01.Schemas.OutputSchema1.ClientScenario">

<xsl:template name="GABClientScenarioUsingExternalStylesheet" match="ns0:ClientScenario">
  <xsl:element name="ns1:ClientScenario">
     <xsl:call-template name="OutputHeaderNode">
     </xsl:call-template>
     <xsl:for-each select="SQLRecord">
          <xsl:call-template name="OutputDetailNode">
          </xsl:call-template>
     </xsl:for-each>
     <xsl:call-template name="OutputTrailerNode">
     </xsl:call-template>
  </xsl:element>
</xsl:template>
<xsl:template name="OutputHeaderNode">
     <Header>
         <RecordType>HEADER</RecordType>
         <FileDate>20081126083500</FileDate>
         <AccountId>00041BUNCH FEES</AccountId>
         <Filler> </Filler>
     </Header>
</xsl:template>
<xsl:template name="OutputDetailNode">
     <Detail>
         <BillDate><xsl:value-of select="string(BILLDATE)" /></BillDate>
         <EmployeeName><xsl:value-of select="concat(string(EMPLOYEELASTNAME),',',string(EMPLOYEEFIRSTNAME))" /></EmployeeName>
         <ClaimNumber><xsl:value-of select="string(CLAIMNUMBER)" /></ClaimNumber>
     </Detail>
</xsl:template>
<xsl:template name="OutputTrailerNode">
     <Trailer>
         <RecordType>TRAILER</RecordType>
         <FileDate><xsl:value-of select="ext:GetDateTimeNow()" /></FileDate>
         <RecordCount><xsl:value-of select="count(SQLRecord)" /></RecordCount>
         <Filler> </Filler>
     </Trailer>
</xsl:template>
<msxsl:script implements-prefix="ext" language="CSharp">
  public string GetDateTimeNow()
  {
    return DateTime.Now.ToString("yyyyMMddHHmmss");
  }
</msxsl:script>

</xsl:stylesheet>

Note: the following map properties:
Validate TestMap Input: True
Validate TestMap Output: True
TestMap Input Instance: C:\DEV\Sandbox\QuikTests\BizTalkMapsTest01\InputSchemaGeneratedOutputTestInstance200811260851.xml
TestMap Input: XML
TestMap Output: Native
TestMap Output Instance: C:\DEV\Sandbox\QuikTests\BizTalkMapsTest01\TestMapOutputInstance200811260854.dat

Any help would be greatly appreciated.

Thanks in advance for any help,

BizTalk Newbie