B2MML to SAP RFC Transformation

467 views Asked by At

I'm working on a MES(SIMATIC) to ABAP-based system integration using B2MML files which need to be mapped to a RFC Call XML in order to call the SAP function. Both, the source B2MML file and the RFC XML are known, but unfortunately I don't have enough knowledge to create the XSLT between them.

  1. The source B2MML file:
<SyncMaterialLot revision="0.0" environment="Production" lang="en-US" xmlns="http://www.siemens.com/ad/mes/b2mt-1.0" xmlns:oag="http://www.openapplications.org/oagis" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bml="http://www.wbf.org/xml/b2mml-v02" xsi:schemaLocation="http://www.siemens.com/ad/mes/b2mt-1.0 file:///C:/Users/Sitadmin/Desktop/FO/B2MT/B2MT_Schemas/B2MT_MaterialLot.xsd">
    <oag:ApplicationArea>
        <oag:Sender>
            <oag:Task>HON</oag:Task>
        </oag:Sender>
        <oag:CreationDateTime>2014-07-14T15:02:56</oag:CreationDateTime>
        <oag:BODId>04aa4bb2-316f-4c43-abfa-705afd103a61</oag:BODId>
    </oag:ApplicationArea>
    <DataArea>
        <oag:Sync confirm="Always">
            <oag:SyncCriteria>
                <oag:SyncExpression action="Add"/>
            </oag:SyncCriteria>
        </oag:Sync>
        <bml:MaterialLot>
            <bml:ID>SLA000000129417E</bml:ID>
            <bml:Description>202220-002</bml:Description>
            <bml:MaterialDefinitionID>PC-SLAB</bml:MaterialDefinitionID>
            <bml:Status>LT-PR</bml:Status>
            <bml:MaterialLotProperty>
                <bml:ID>AutoControlComment</bml:ID>
                <bml:Description>Comentariu autocontrol</bml:Description>
                <bml:Value>
                    <bml:ValueString/>
                    <bml:DataType>string</bml:DataType>
                    <bml:UnitOfMeasure>n/a</bml:UnitOfMeasure>
                    <bml:Any/>
                </bml:Value>
            </bml:MaterialLotProperty>
            <bml:MaterialLotProperty>
                <bml:ID>AutoControlDecision</bml:ID>
                <bml:Description>Decizie autocontrol</bml:Description>
                <bml:Value>
                    <bml:ValueString>1</bml:ValueString>
                    <bml:DataType>string</bml:DataType>
                    <bml:UnitOfMeasure>n/a</bml:UnitOfMeasure>
                    <bml:Any/>
                </bml:Value>
            </bml:MaterialLotProperty>
            <bml:MaterialLotProperty>
                <bml:ID>AutoControlRecAction</bml:ID>
                <bml:Description>Actiune înreg. Autocontrol</bml:Description>
                <bml:Value>
                    <bml:ValueString/>
                    <bml:DataType>string</bml:DataType>
                    <bml:UnitOfMeasure>n/a</bml:UnitOfMeasure>
                    <bml:Any/>
                </bml:Value>
            </bml:MaterialLotProperty>
            <bml:MaterialLotProperty>
                <bml:ID>CCP_Aspect</bml:ID>
                <bml:Description>Aspect CCP</bml:Description>
                <bml:Value>
                    <bml:ValueString>7</bml:ValueString>
                    <bml:DataType>integer</bml:DataType>
                    <bml:UnitOfMeasure>n/a</bml:UnitOfMeasure>
                    <bml:Any/>
                </bml:Value>
            </bml:MaterialLotProperty>
            <bml:MaterialLotProperty>
                <bml:ID>CCP_Cleanliness</bml:ID>
                <bml:Description>Puritate CCP</bml:Description>
                <bml:Value>
                    <bml:ValueString>6</bml:ValueString>
                    <bml:DataType>integer</bml:DataType>
                    <bml:UnitOfMeasure>n/a</bml:UnitOfMeasure>
                    <bml:Any/>
                </bml:Value>
            </bml:MaterialLotProperty>
            <bml:StorageLocation>MTC4-Strand8</bml:StorageLocation>
            <bml:Quantity>
                <bml:QuantityString>14.593</bml:QuantityString>
                <bml:DataType>decimal</bml:DataType>
                <bml:UnitOfMeasure>ton</bml:UnitOfMeasure>
                <bml:Any/>
            </bml:Quantity>
        </bml:MaterialLot>
    </DataArea>
</SyncMaterialLot>
  1. The destination XML file
<?xml version="1.0" encoding="UTF-16" standalone="yes"?>
<!-- edited with XMLSpy v2011 rel. 3 sp1 (http://www.altova.com)-->
<RfcFunction rfcFunctionName="ZPEL_MATLOT_INBOUND" Unicode="false" version="xx.xx.xx.xx">
    <Imports>
        <SimpleParam paramName="I_ERASE_ALL" paramLength="1" nucLength="1" ucLength="2" paramType="0" descriptionType="RFCTYPE_CHAR" decimal="0" optional="1"/>
    </Imports>
    <Exports/>
    <Changing/>
    <RfcTables>
        <Table tName="T_APPAREA" tucLength="1276" tnucLength="638">
            <Header>
                <cl clName="LOGICALID" clnucLength="50" clnucOffset="0" clucLength="100" clucOffset="0" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="0"/>
                <cl clName="COMPONENT" clnucLength="100" clnucOffset="50" clucLength="200" clucOffset="100" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="1"/>
                <cl clName="TASK" clnucLength="100" clnucOffset="150" clucLength="200" clucOffset="300" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="2"/>
                <cl clName="REFERENCEID" clnucLength="50" clnucOffset="250" clucLength="100" clucOffset="500" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="3"/>
                <cl clName="CONFIRMATION" clnucLength="50" clnucOffset="300" clucLength="100" clucOffset="600" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="4"/>
                <cl clName="AUTHORIZATIONID" clnucLength="50" clnucOffset="350" clucLength="100" clucOffset="700" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="5"/>
                <cl clName="CREATIONDATETIME" clnucLength="50" clnucOffset="400" clucLength="100" clucOffset="800" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="6"/>
                <cl clName="SIGNATURE" clnucLength="50" clnucOffset="450" clucLength="100" clucOffset="900" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="7"/>
                <cl clName="BODID" clnucLength="38" clnucOffset="500" clucLength="76" clucOffset="1000" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="8">1123</cl>
                <cl clName="USERAREA" clnucLength="100" clnucOffset="538" clucLength="200" clucOffset="1076" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="9"/>
            </Header>
            <body rowCounter="1">
                <tr>
                    <Item/>
                    <Item/>
                    <Item>HON</Item>
                    <Item/>
                    <Item/>
                    <Item/>
                    <Item/>
                    <Item/>
                    <Item>04aa4bb2-316f-4c43-abfa-705afd103a61</Item>
                    <Item>SAP_OUTPUT_5772649_20141116041806591.xml</Item> 
                </tr>
            </body>
        </Table>
        <Table tName="T_DATAAREA" tucLength="1276" tnucLength="638">
            <Header>
                <cl clName="SYNCEXPRESSION" clnucLength="50" clnucOffset="0" clucLength="100" clucOffset="0" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="0"/>
                <cl clName="MATLOTID" clnucLength="38" clnucOffset="50" clucLength="76" clucOffset="100" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="1"/>
                <cl clName="DESCRIPTION" clnucLength="100" clnucOffset="88" clucLength="200" clucOffset="176" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="2"/>
                <cl clName="MATDEFID" clnucLength="50" clnucOffset="188" clucLength="100" clucOffset="376" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="3"/>
                <cl clName="STATUS" clnucLength="50" clnucOffset="238" clucLength="100" clucOffset="476" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="4"/>
                <cl clName="EQUIPMENTID" clnucLength="50" clnucOffset="288" clucLength="100" clucOffset="576" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="5"/>
                <cl clName="EQUIPMENTELEMENTLVL" clnucLength="50" clnucOffset="338" clucLength="100" clucOffset="676" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="6"/>
                <cl clName="LOCATION" clnucLength="50" clnucOffset="388" clucLength="100" clucOffset="776" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="7"/>
                <cl clName="STORAGELOCATION" clnucLength="50" clnucOffset="438" clucLength="100" clucOffset="876" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="8"/>
                <cl clName="QUANTITY" clnucLength="50" clnucOffset="488" clucLength="100" clucOffset="976" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="9"/>
                <cl clName="UM" clnucLength="50" clnucOffset="538" clucLength="100" clucOffset="1076" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="10"/>
                <cl clName="ANYTXT" clnucLength="50" clnucOffset="588" clucLength="100" clucOffset="1176" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="11"/>
            </Header>
            <body rowCounter="1">
                <tr>
                    <Item>Add</Item>
                    <Item>SLA000000129417E</Item>
                    <Item>202220-002</Item>
                    <Item>PC-SLAB</Item>
                    <Item>LT-PR</Item>
                    <Item/>
                    <Item/>
                    <Item/>
                    <Item>MTC4-Strand8</Item>
                    <Item>14.593</Item>
                    <Item>ton</Item>
                    <Item/>
                </tr>
            </body>
        </Table>
        <Table tName="T_MATLOTPROP" tucLength="1052" tnucLength="526">
            <Header>
                <cl clName="MATLOTID" clnucLength="38" clnucOffset="0" clucLength="76" clucOffset="0" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="0"/>
                <cl clName="PROPERTYID" clnucLength="38" clnucOffset="38" clucLength="76" clucOffset="76" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="1"/>
                <cl clName="DESCRIPTION" clnucLength="100" clnucOffset="76" clucLength="200" clucOffset="152" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="2"/>
                <cl clName="VALUE" clnucLength="150" clnucOffset="176" clucLength="300" clucOffset="352" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="3"/>
                <cl clName="DATATYPE" clnucLength="50" clnucOffset="326" clucLength="100" clucOffset="652" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="4"/>
                <cl clName="UM" clnucLength="50" clnucOffset="376" clucLength="100" clucOffset="752" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="5"/>
                <cl clName="TESTSPECID" clnucLength="50" clnucOffset="426" clucLength="100" clucOffset="852" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="6"/>
                <cl clName="ANYTXT" clnucLength="50" clnucOffset="476" clucLength="100" clucOffset="952" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="7"/>
            </Header>
            <body rowCounter="2">
                <tr>
                    <Item>SLA000000129417E</Item>
                    <Item>AutoControlDecision</Item>
                    <Item>Decizie autocontrol</Item>
                    <Item>1</Item>
                    <Item>string</Item>
                    <Item>n/a</Item>
                    <Item/>
                    <Item/>
                </tr>
                <tr>
                    <Item>SLA000000129417E</Item>
                    <Item>CCP_Aspect</Item>
                    <Item>Aspect CCP</Item>
                    <Item>7</Item>
                    <Item>integer</Item>
                    <Item>n/a</Item>
                    <Item/>
                    <Item/>
                </tr>
            </body>
        </Table>
        <Table tName="T_RETURN" tucLength="1088" tnucLength="548">
            <Header>
                <cl clName="TYPE" clnucLength="1" clnucOffset="0" clucLength="2" clucOffset="0" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="0"/>
                <cl clName="ID" clnucLength="20" clnucOffset="1" clucLength="40" clucOffset="2" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="1"/>
                <cl clName="NUMBER" clnucLength="3" clnucOffset="21" clucLength="6" clucOffset="42" clType="6" decimal="0" sapType="RFCTYPE_NUM" seqNum="2"/>
                <cl clName="MESSAGE" clnucLength="220" clnucOffset="24" clucLength="440" clucOffset="48" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="3"/>
                <cl clName="LOG_NO" clnucLength="20" clnucOffset="244" clucLength="40" clucOffset="488" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="4"/>
                <cl clName="LOG_MSG_NO" clnucLength="6" clnucOffset="264" clucLength="12" clucOffset="528" clType="6" decimal="0" sapType="RFCTYPE_NUM" seqNum="5"/>
                <cl clName="MESSAGE_V1" clnucLength="50" clnucOffset="270" clucLength="100" clucOffset="540" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="6"/>
                <cl clName="MESSAGE_V2" clnucLength="50" clnucOffset="320" clucLength="100" clucOffset="640" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="7"/>
                <cl clName="MESSAGE_V3" clnucLength="50" clnucOffset="370" clucLength="100" clucOffset="740" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="8"/>
                <cl clName="MESSAGE_V4" clnucLength="50" clnucOffset="420" clucLength="100" clucOffset="840" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="9"/>
                <cl clName="PARAMETER" clnucLength="32" clnucOffset="470" clucLength="64" clucOffset="940" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="10"/>
                <cl clName="ROW" clnucLength="4" clnucOffset="504" clucLength="4" clucOffset="1004" clType="8" decimal="0" sapType="RFCTYPE_INT" seqNum="11"/>
                <cl clName="FIELD" clnucLength="30" clnucOffset="508" clucLength="60" clucOffset="1008" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="12"/>
                <cl clName="SYSTEM" clnucLength="10" clnucOffset="538" clucLength="20" clucOffset="1068" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="13"/>
            </Header>
            <body rowCounter="0"/>
        </Table>
        <Table tName="T_SUBLOT" tucLength="952" tnucLength="476">
            <Header>
                <cl clName="MATLOTID" clnucLength="38" clnucOffset="0" clucLength="76" clucOffset="0" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="0"/>
                <cl clName="SUBLOTID" clnucLength="38" clnucOffset="38" clucLength="76" clucOffset="76" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="1"/>
                <cl clName="DESCRIPTION" clnucLength="100" clnucOffset="76" clucLength="200" clucOffset="152" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="2"/>
                <cl clName="STATUS" clnucLength="50" clnucOffset="176" clucLength="100" clucOffset="352" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="3"/>
                <cl clName="STORAGELOCATION" clnucLength="50" clnucOffset="226" clucLength="100" clucOffset="452" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="4"/>
                <cl clName="QUANTITY" clnucLength="50" clnucOffset="276" clucLength="100" clucOffset="552" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="5"/>
                <cl clName="UM" clnucLength="50" clnucOffset="326" clucLength="100" clucOffset="652" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="6"/>
                <cl clName="MATSUBLOT" clnucLength="50" clnucOffset="376" clucLength="100" clucOffset="752" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="7"/>
                <cl clName="ANYTXT" clnucLength="50" clnucOffset="426" clucLength="100" clucOffset="852" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="8"/>
            </Header>
            <body rowCounter="0"/>
        </Table>
        <Table tName="T_TESTRESULTS" tucLength="1028" tnucLength="514">
            <Header>
                <cl clName="MATLOTID" clnucLength="38" clnucOffset="0" clucLength="76" clucOffset="0" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="0"/>
                <cl clName="PROPERTYID" clnucLength="38" clnucOffset="38" clucLength="76" clucOffset="76" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="1"/>
                <cl clName="TESTID" clnucLength="38" clnucOffset="76" clucLength="76" clucOffset="152" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="2"/>
                <cl clName="DESCRIPTION" clnucLength="100" clnucOffset="114" clucLength="200" clucOffset="228" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="3"/>
                <cl clName="TESTDATETIME" clnucLength="50" clnucOffset="214" clucLength="100" clucOffset="428" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="4"/>
                <cl clName="RESULTVALUE" clnucLength="50" clnucOffset="264" clucLength="100" clucOffset="528" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="5"/>
                <cl clName="RESULTDATATYPE" clnucLength="50" clnucOffset="314" clucLength="100" clucOffset="628" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="6"/>
                <cl clName="RESULTANY" clnucLength="50" clnucOffset="364" clucLength="100" clucOffset="728" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="7"/>
                <cl clName="EXPIRATIONTIME" clnucLength="50" clnucOffset="414" clucLength="100" clucOffset="828" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="8"/>
                <cl clName="ANYTXT" clnucLength="50" clnucOffset="464" clucLength="100" clucOffset="928" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="9"/>
            </Header>
            <body rowCounter="0"/>
        </Table>
    </RfcTables>
    <RFC_Exceptions/>
</RfcFunction>

There are three zones in the source file for mapping: ApplicationArea [0..1], DataArea [0..1] and MaterialLotProperty [1..n], mapped to three ABAP tables: T_APPAREA, T_DATAAREA and T_MATLOTPROP. The other parameters must not be transformed.

I only managed to map ApplicationArea but I got stuck with DataArea :

<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.siemens.com/ad/mes/b2mt-1.0" xmlns:amg="Pelican@ArcelorMittalGalati" xmlns:bml="http://www.wbf.org/xml/b2mml-v02" xmlns:oag="http://www.openapplications.org/oagis" xmlns:sit="http://www.siemens.com/ad/mes/b2mml-v02-SITExt-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
    <xsl:template match="*">
        <RfcFunction rfcFunctionName="ZPEL_MATLOT_INBOUND" Unicode="false" version="xx.xx.xx.xx">
            <Imports>
                <SimpleParam paramName="I_ERASE_ALL" paramLength="1" nucLength="1" ucLength="2" paramType="0" descriptionType="RFCTYPE_CHAR" decimal="0" optional="1"/>
            </Imports>
            <Exports/>
            <Changing/>
            <RfcTables>
                    <xsl:apply-templates select="oag:ApplicationArea"/>
                    <xsl:apply-templates select="DataArea"/>
            </RfcTables>
            <RFC_Exceptions/>
        </RfcFunction>
    </xsl:template>
    <xsl:template match="oag:ApplicationArea">
        <Table tName="T_APPAREA" tucLength="1276" tnucLength="638">
            <Header>
                <cl clName="LOGICALID" clnucLength="50" clnucOffset="0" clucLength="100" clucOffset="0" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="0"/>
                <cl clName="COMPONENT" clnucLength="100" clnucOffset="50" clucLength="200" clucOffset="100" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="1"/>
                <cl clName="TASK" clnucLength="100" clnucOffset="150" clucLength="200" clucOffset="300" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="2"/>
                <cl clName="REFERENCEID" clnucLength="50" clnucOffset="250" clucLength="100" clucOffset="500" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="3"/>
                <cl clName="CONFIRMATION" clnucLength="50" clnucOffset="300" clucLength="100" clucOffset="600" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="4"/>
                <cl clName="AUTHORIZATIONID" clnucLength="50" clnucOffset="350" clucLength="100" clucOffset="700" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="5"/>
                <cl clName="CREATIONDATETIME" clnucLength="50" clnucOffset="400" clucLength="100" clucOffset="800" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="6"/>
                <cl clName="SIGNATURE" clnucLength="50" clnucOffset="450" clucLength="100" clucOffset="900" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="7"/>
                <cl clName="BODID" clnucLength="38" clnucOffset="500" clucLength="76" clucOffset="1000" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="8"/>
                <cl clName="USERAREA" clnucLength="100" clnucOffset="538" clucLength="200" clucOffset="1076" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="9"/>
            </Header>
            <body>
                <xsl:attribute name="rowCounter"><xsl:value-of select="string(count(ApplicationArea))"/></xsl:attribute>
                <tr>
                    <Item/>
                    <Item/>
                    <Item>
                        <xsl:value-of select="oag:Sender/oag:Task"/>
                    </Item>
                    <Item/>
                    <Item/>
                    <Item/>
                    <Item>
                        <xsl:value-of select="oag:CreationDateTime"/>
                    </Item>
                    <Item/>
                    <Item>
                        <xsl:value-of select="oag:BODId"/>
                    </Item>
                    <Item>
                        <xsl:value-of select="substring-after(document-uri(/),'/')"/>
                    </Item>
                </tr>
            </body>
        </Table>
    </xsl:template>
    <xsl:template match="DataArea">
        <Table tName="T_DATAAREA" tucLength="1276" tnucLength="638">
            <Header>
                <cl clName="SYNCEXPRESSION" clnucLength="50" clnucOffset="0" clucLength="100" clucOffset="0" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="0"/>
                <cl clName="MATLOTID" clnucLength="38" clnucOffset="50" clucLength="76" clucOffset="100" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="1"/>
                <cl clName="DESCRIPTION" clnucLength="100" clnucOffset="88" clucLength="200" clucOffset="176" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="2"/>
                <cl clName="MATDEFID" clnucLength="50" clnucOffset="188" clucLength="100" clucOffset="376" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="3"/>
                <cl clName="STATUS" clnucLength="50" clnucOffset="238" clucLength="100" clucOffset="476" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="4"/>
                <cl clName="EQUIPMENTID" clnucLength="50" clnucOffset="288" clucLength="100" clucOffset="576" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="5"/>
                <cl clName="EQUIPMENTELEMENTLVL" clnucLength="50" clnucOffset="338" clucLength="100" clucOffset="676" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="6"/>
                <cl clName="LOCATION" clnucLength="50" clnucOffset="388" clucLength="100" clucOffset="776" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="7"/>
                <cl clName="STORAGELOCATION" clnucLength="50" clnucOffset="438" clucLength="100" clucOffset="876" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="8"/>
                <cl clName="QUANTITY" clnucLength="50" clnucOffset="488" clucLength="100" clucOffset="976" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="9"/>
                <cl clName="UM" clnucLength="50" clnucOffset="538" clucLength="100" clucOffset="1076" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="10"/>
                <cl clName="ANYTXT" clnucLength="50" clnucOffset="588" clucLength="100" clucOffset="1176" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="11"/>
            </Header>
            <body>
                <xsl:attribute name="rowCounter"><xsl:value-of select="string(count(DataArea))"/></xsl:attribute>
                <tr>
                    <Item>Add</Item>
                    <Item>SLA000000129417E</Item>
                    <Item>922678-030</Item>
                    <Item>PC-SLAB</Item>
                    <Item>LT-REL</Item>
                    <Item/>
                    <Item/>
                    <Item/>
                    <Item>MTC1-Strand2</Item>
                    <Item>20.606</Item>
                    <Item>ton</Item>
                    <Item/>
                </tr>
            </body>
        </Table>
    </xsl:template>
</xsl:transform>

How do I correct the transformation?

1

There are 1 answers

1
DoruB On

to whom it may interest the answer. I've solved it without using templates:

The XSLT (1.0):

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:oag="http://www.openapplications.org/oagis" xmlns:a="http://www.siemens.com/ad/mes/b2mt-1.0" xmlns:bml="http://www.wbf.org/xml/b2mml-v02">
    <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
    <xsl:template match="/">
        <RfcFunction>
            <RfcTables>
                <Table tName="T_APPAREA" tucLength="1276" tnucLength="638">
                    <Header>
                        <cl clName="LOGICALID" clnucLength="50" clnucOffset="0" clucLength="100" clucOffset="0" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="0"/>
                        <cl clName="COMPONENT" clnucLength="100" clnucOffset="50" clucLength="200" clucOffset="100" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="1"/>
                        <cl clName="TASK" clnucLength="100" clnucOffset="150" clucLength="200" clucOffset="300" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="2"/>
                        <cl clName="REFERENCEID" clnucLength="50" clnucOffset="250" clucLength="100" clucOffset="500" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="3"/>
                        <cl clName="CONFIRMATION" clnucLength="50" clnucOffset="300" clucLength="100" clucOffset="600" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="4"/>
                        <cl clName="AUTHORIZATIONID" clnucLength="50" clnucOffset="350" clucLength="100" clucOffset="700" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="5"/>
                        <cl clName="CREATIONDATETIME" clnucLength="50" clnucOffset="400" clucLength="100" clucOffset="800" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="6"/>
                        <cl clName="SIGNATURE" clnucLength="50" clnucOffset="450" clucLength="100" clucOffset="900" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="7"/>
                        <cl clName="BODID" clnucLength="38" clnucOffset="500" clucLength="76" clucOffset="1000" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="8"/>
                        <cl clName="USERAREA" clnucLength="100" clnucOffset="538" clucLength="200" clucOffset="1076" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="9"/>
                    </Header>
                    <body>
                        <xsl:attribute name="rowCounter"><xsl:value-of select="count(a:SyncMaterialLot/oag:ApplicationArea)"/></xsl:attribute>
                        <tr>
                            <Item/>
                            <Item/>
                            <Item>
                                <xsl:value-of select="a:SyncMaterialLot/oag:ApplicationArea/oag:Sender/oag:Task"/>
                            </Item>
                            <Item/>
                            <Item/>
                            <Item/>
                            <Item>
                                <xsl:value-of select="a:SyncMaterialLot/oag:ApplicationArea/oag:CreationDateTime"/>
                            </Item>
                            <Item/>
                            <Item>
                                <xsl:value-of select="a:SyncMaterialLot/oag:ApplicationArea/oag:BODId"/>
                            </Item>
                            <Item/>
                        </tr>
                    </body>
                </Table>
                <Table tName="T_DATAAREA" tucLength="1276" tnucLength="638">
                    <Header>
                        <cl clName="SYNCEXPRESSION" clnucLength="50" clnucOffset="0" clucLength="100" clucOffset="0" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="0"/>
                        <cl clName="MATLOTID" clnucLength="38" clnucOffset="50" clucLength="76" clucOffset="100" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="1"/>
                        <cl clName="DESCRIPTION" clnucLength="100" clnucOffset="88" clucLength="200" clucOffset="176" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="2"/>
                        <cl clName="MATDEFID" clnucLength="50" clnucOffset="188" clucLength="100" clucOffset="376" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="3"/>
                        <cl clName="STATUS" clnucLength="50" clnucOffset="238" clucLength="100" clucOffset="476" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="4"/>
                        <cl clName="EQUIPMENTID" clnucLength="50" clnucOffset="288" clucLength="100" clucOffset="576" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="5"/>
                        <cl clName="EQUIPMENTELEMENTLVL" clnucLength="50" clnucOffset="338" clucLength="100" clucOffset="676" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="6"/>
                        <cl clName="LOCATION" clnucLength="50" clnucOffset="388" clucLength="100" clucOffset="776" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="7"/>
                        <cl clName="STORAGELOCATION" clnucLength="50" clnucOffset="438" clucLength="100" clucOffset="876" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="8"/>
                        <cl clName="QUANTITY" clnucLength="50" clnucOffset="488" clucLength="100" clucOffset="976" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="9"/>
                        <cl clName="UM" clnucLength="50" clnucOffset="538" clucLength="100" clucOffset="1076" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="10"/>
                        <cl clName="ANYTXT" clnucLength="50" clnucOffset="588" clucLength="100" clucOffset="1176" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="11"/>
                    </Header>
                    <body>
                        <xsl:attribute name="rowCounter"><xsl:value-of select="count(a:SyncMaterialLot/a:DataArea)"/></xsl:attribute>
                        <tr>
                            <Item>
                                <xsl:value-of select="a:SyncMaterialLot/a:DataArea/oag:Sync/oag:SyncCriteria/oag:SyncExpression/@action"/>
                            </Item>
                            <Item>
                                <xsl:value-of select="a:SyncMaterialLot/a:DataArea/bml:MaterialLot/bml:ID"/>
                            </Item>
                            <Item>
                                <xsl:value-of select="a:SyncMaterialLot/a:DataArea/bml:MaterialLot/bml:Description"/>
                            </Item>
                            <Item>
                                <xsl:value-of select="a:SyncMaterialLot/a:DataArea/bml:MaterialLot/bml:MaterialDefinitionID"/>
                            </Item>
                            <Item>
                                <xsl:value-of select="a:SyncMaterialLot/a:DataArea/bml:MaterialLot/bml:Status"/>
                            </Item>
                            <Item/>
                            <Item/>
                            <Item/>
                            <Item>
                                <xsl:value-of select="a:SyncMaterialLot/a:DataArea/bml:MaterialLot/bml:StorageLocation"/>
                            </Item>
                            <Item>
                                <xsl:value-of select="a:SyncMaterialLot/a:DataArea/bml:MaterialLot/bml:Quantity/bml:QuantityString"/>
                            </Item>
                            <Item>ton</Item>
                            <Item/>
                        </tr>
                    </body>
                </Table>
                <Table tName="T_MATLOTPROP" tucLength="1052" tnucLength="526">
                    <Header>
                        <cl clName="MATLOTID" clnucLength="38" clnucOffset="0" clucLength="76" clucOffset="0" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="0"/>
                        <cl clName="PROPERTYID" clnucLength="38" clnucOffset="38" clucLength="76" clucOffset="76" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="1"/>
                        <cl clName="DESCRIPTION" clnucLength="100" clnucOffset="76" clucLength="200" clucOffset="152" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="2"/>
                        <cl clName="VALUE" clnucLength="150" clnucOffset="176" clucLength="300" clucOffset="352" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="3"/>
                        <cl clName="DATATYPE" clnucLength="50" clnucOffset="326" clucLength="100" clucOffset="652" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="4"/>
                        <cl clName="UM" clnucLength="50" clnucOffset="376" clucLength="100" clucOffset="752" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="5"/>
                        <cl clName="TESTSPECID" clnucLength="50" clnucOffset="426" clucLength="100" clucOffset="852" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="6"/>
                        <cl clName="ANYTXT" clnucLength="50" clnucOffset="476" clucLength="100" clucOffset="952" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="7"/>
                    </Header>
                    <body>
                        <xsl:attribute name="rowCounter"><xsl:value-of select="count(a:SyncMaterialLot/a:DataArea/bml:MaterialLot/bml:MaterialLotProperty)"/></xsl:attribute>
                        <xsl:for-each select="a:SyncMaterialLot/a:DataArea/bml:MaterialLot/bml:MaterialLotProperty">
                            <tr>
                                <Item>
                                    <xsl:value-of select="../bml:ID"/>
                                </Item>
                                <Item>
                                    <xsl:value-of select="bml:ID"/>
                                </Item>
                                <Item>
                                    <xsl:value-of select="bml:Description"/>
                                </Item>
                                <Item>
                                    <xsl:value-of select="bml:Value/bml:ValueString"/>
                                </Item>
                                <Item>
                                    <xsl:value-of select="bml:Value/bml:DataType"/>
                                </Item>
                                <Item>
                                    <xsl:value-of select="bml:Value/bml:UnitOfMeasure"/>
                                </Item>
                                <Item>
                                    <xsl:value-of select="bml:Value/bml:Any"/>
                                </Item>
                            </tr>
                        </xsl:for-each>
                    </body>
                </Table>
                <Table tName="T_RETURN" tucLength="1088" tnucLength="548">
                    <Header>
                        <cl clName="TYPE" clnucLength="1" clnucOffset="0" clucLength="2" clucOffset="0" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="0"/>
                        <cl clName="ID" clnucLength="20" clnucOffset="1" clucLength="40" clucOffset="2" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="1"/>
                        <cl clName="NUMBER" clnucLength="3" clnucOffset="21" clucLength="6" clucOffset="42" clType="6" decimal="0" sapType="RFCTYPE_NUM" seqNum="2"/>
                        <cl clName="MESSAGE" clnucLength="220" clnucOffset="24" clucLength="440" clucOffset="48" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="3"/>
                        <cl clName="LOG_NO" clnucLength="20" clnucOffset="244" clucLength="40" clucOffset="488" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="4"/>
                        <cl clName="LOG_MSG_NO" clnucLength="6" clnucOffset="264" clucLength="12" clucOffset="528" clType="6" decimal="0" sapType="RFCTYPE_NUM" seqNum="5"/>
                        <cl clName="MESSAGE_V1" clnucLength="50" clnucOffset="270" clucLength="100" clucOffset="540" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="6"/>
                        <cl clName="MESSAGE_V2" clnucLength="50" clnucOffset="320" clucLength="100" clucOffset="640" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="7"/>
                        <cl clName="MESSAGE_V3" clnucLength="50" clnucOffset="370" clucLength="100" clucOffset="740" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="8"/>
                        <cl clName="MESSAGE_V4" clnucLength="50" clnucOffset="420" clucLength="100" clucOffset="840" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="9"/>
                        <cl clName="PARAMETER" clnucLength="32" clnucOffset="470" clucLength="64" clucOffset="940" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="10"/>
                        <cl clName="ROW" clnucLength="4" clnucOffset="504" clucLength="4" clucOffset="1004" clType="8" decimal="0" sapType="RFCTYPE_INT" seqNum="11"/>
                        <cl clName="FIELD" clnucLength="30" clnucOffset="508" clucLength="60" clucOffset="1008" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="12"/>
                        <cl clName="SYSTEM" clnucLength="10" clnucOffset="538" clucLength="20" clucOffset="1068" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="13"/>
                    </Header>
                    <body rowCounter="0"/>
                </Table>
                <Table tName="T_SUBLOT" tucLength="952" tnucLength="476">
                    <Header>
                        <cl clName="MATLOTID" clnucLength="38" clnucOffset="0" clucLength="76" clucOffset="0" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="0"/>
                        <cl clName="SUBLOTID" clnucLength="38" clnucOffset="38" clucLength="76" clucOffset="76" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="1"/>
                        <cl clName="DESCRIPTION" clnucLength="100" clnucOffset="76" clucLength="200" clucOffset="152" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="2"/>
                        <cl clName="STATUS" clnucLength="50" clnucOffset="176" clucLength="100" clucOffset="352" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="3"/>
                        <cl clName="STORAGELOCATION" clnucLength="50" clnucOffset="226" clucLength="100" clucOffset="452" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="4"/>
                        <cl clName="QUANTITY" clnucLength="50" clnucOffset="276" clucLength="100" clucOffset="552" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="5"/>
                        <cl clName="UM" clnucLength="50" clnucOffset="326" clucLength="100" clucOffset="652" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="6"/>
                        <cl clName="MATSUBLOT" clnucLength="50" clnucOffset="376" clucLength="100" clucOffset="752" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="7"/>
                        <cl clName="ANYTXT" clnucLength="50" clnucOffset="426" clucLength="100" clucOffset="852" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="8"/>
                    </Header>
                    <body rowCounter="0"/>
                </Table>
                <Table tName="T_TESTRESULTS" tucLength="1028" tnucLength="514">
                    <Header>
                        <cl clName="MATLOTID" clnucLength="38" clnucOffset="0" clucLength="76" clucOffset="0" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="0"/>
                        <cl clName="PROPERTYID" clnucLength="38" clnucOffset="38" clucLength="76" clucOffset="76" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="1"/>
                        <cl clName="TESTID" clnucLength="38" clnucOffset="76" clucLength="76" clucOffset="152" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="2"/>
                        <cl clName="DESCRIPTION" clnucLength="100" clnucOffset="114" clucLength="200" clucOffset="228" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="3"/>
                        <cl clName="TESTDATETIME" clnucLength="50" clnucOffset="214" clucLength="100" clucOffset="428" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="4"/>
                        <cl clName="RESULTVALUE" clnucLength="50" clnucOffset="264" clucLength="100" clucOffset="528" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="5"/>
                        <cl clName="RESULTDATATYPE" clnucLength="50" clnucOffset="314" clucLength="100" clucOffset="628" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="6"/>
                        <cl clName="RESULTANY" clnucLength="50" clnucOffset="364" clucLength="100" clucOffset="728" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="7"/>
                        <cl clName="EXPIRATIONTIME" clnucLength="50" clnucOffset="414" clucLength="100" clucOffset="828" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="8"/>
                        <cl clName="ANYTXT" clnucLength="50" clnucOffset="464" clucLength="100" clucOffset="928" clType="0" decimal="0" sapType="RFCTYPE_CHAR" seqNum="9"/>
                    </Header>
                    <body rowCounter="0"/>
                </Table>
            </RfcTables>
        </RfcFunction>
    </xsl:template>
</xsl:stylesheet>