Page 1 of 1

XSLT Mapping error

Posted: Tue Jan 12, 2016 9:47 am
by hamjas
Hi,

Am executing folowing code and I am not getting E1BP2017_GM_SERIALNUMBER node during output.
Am completely new to XSLT mapping and please help me what is causing the above said node is not getting executed.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!--
This file was generated by Altova MapForce 2012r2

YOU SHOULD NOT MODIFY THIS FILE, BECAUSE IT WILL BE
OVERWRITTEN WHEN YOU RE-RUN CODE GENERATION.

Refer to the Altova MapForce Documentation for further details.
http://www.altova.com/mapforce
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://www.Apriso.com/FlexNet.BusinessFacade.Inventory.Inventory2History.xsd" xmlns:agt="http://www.altova.com/Mapforce/agt" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="ns0 agt xs">
<xsl:include href="Apriso_Functions.xsl"/>
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template name="agt:var3_MapToMBGMCR02_function">
<xsl:param name="par0"/>
<xsl:param name="par1"/>
<E1BP2017_GM_ITEM_CREATE>
<xsl:attribute name="SEGMENT"><xsl:value-of select="string('1')"/></xsl:attribute>
<xsl:for-each select="$par0/ns0:ProductNo">
<MATERIAL>
<xsl:value-of select="string(.)"/>
</MATERIAL>
</xsl:for-each>
<xsl:for-each select="$par1/ns0:Facility">
<PLANT>
<xsl:value-of select="string(.)"/>
</PLANT>
</xsl:for-each>
<xsl:for-each select="$par0/ns0:ERPMaterialStock">
<STGE_LOC>
<xsl:value-of select="string(.)"/>
</STGE_LOC>
</xsl:for-each>
<xsl:for-each select="$par0/ns0:LotNo">
<BATCH>
<xsl:value-of select="string(.)"/>
</BATCH>
</xsl:for-each>
<xsl:for-each select="$par0/ns0:HostMovementCode">
<MOVE_TYPE>
<xsl:value-of select="string(.)"/>
</MOVE_TYPE>
</xsl:for-each>
<xsl:for-each select="($par0/ns0:InventoryStatus)[((floor(number(string(.))) = '1') or ((floor(number(string(.))) = '2') or (floor(number(string(.))) = '3')))]">
<STCK_TYPE>
<xsl:choose>
<xsl:when test="string((floor(number(string(.))) = '1')) != 'false'">
<xsl:value-of select="'F'"/>
</xsl:when>
<xsl:when test="string((floor(number(string(.))) = '2')) != 'false'">
<xsl:value-of select="'X'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'S'"/>
</xsl:otherwise>
</xsl:choose>
</STCK_TYPE>
</xsl:for-each>
<xsl:for-each select="$par0/ns0:HostIndicator1">
<SPEC_STOCK>
<xsl:value-of select="string(.)"/>
</SPEC_STOCK>
</xsl:for-each>
<xsl:for-each select="$par0/ns0:PartnerNo">
<VENDOR>
<xsl:value-of select="string(.)"/>
</VENDOR>
</xsl:for-each>
<xsl:for-each select="$par1/ns0:OrderPartnerNo">
<CUSTOMER>
<xsl:value-of select="string(.)"/>
</CUSTOMER>
</xsl:for-each>
<xsl:for-each select="$par0/ns0:Quantity">
<ENTRY_QNT>
<xsl:call-template name="FormatNumber_3DecimalPoint">
<xsl:with-param name="Value" select="."/>
</xsl:call-template>
</ENTRY_QNT>
</xsl:for-each>
<xsl:for-each select="$par0/ns0:UomCode">
<ENTRY_UOM>
<xsl:value-of select="string(.)"/>
</ENTRY_UOM>
</xsl:for-each>
<xsl:for-each select="$par1/ns0:OrderNo">
<PO_NUMBER>
<xsl:value-of select="string(.)"/>
</PO_NUMBER>
</xsl:for-each>
<xsl:for-each select="$par1/ns0:OrderLineNo">
<PO_ITEM>
<xsl:value-of select="string(floor(number(string(.))))"/>
</PO_ITEM>
</xsl:for-each>
<xsl:for-each select="$par1/ns0:CostCenter">
<COSTCENTER>
<xsl:value-of select="string(.)"/>
</COSTCENTER>
</xsl:for-each>
<!-- <xsl:for-each select="$par0/ns0:OrderNo">
<
>
<xsl:value-of select="string(.)"/>
</ORDERID>
</xsl:for-each>-->
<xsl:for-each select="ns0:FlexNet.BusinessFacade.Inventory.Inventory2History/ns0:FlexNet.BusinessRules.Inventory.Inventory2History/ns0:InventoryDetail/ns0:OrderNo">
<xsl:variable name="var2_current" select="."/>
<ORDERID>
<xsl:value-of select="ceiling(.)"/>
</ORDERID>
</xsl:for-each>
<xsl:for-each select="$par0/ns0:ReferenceOrderNumber">
<RESERV_NO>
<xsl:value-of select="string(.)"/>
</RESERV_NO>
</xsl:for-each>
<xsl:for-each select="$par0/ns0:ReferenceOrderLineNumber">
<RES_ITEM>
<xsl:value-of select="string(.)"/>
</RES_ITEM>
</xsl:for-each>
<xsl:for-each select="$par0/ns0:HostIndicator2">
<MVT_IND>
<xsl:value-of select="string(.)"/>
</MVT_IND>
</xsl:for-each>
<MATDOC_ITM>
<xsl:value-of select="string('1')"/>
</MATDOC_ITM>
</E1BP2017_GM_ITEM_CREATE>
</xsl:template>
<xsl:template name="agt:var11_MapToMBGMCR02_function">
<xsl:param name="par0"/>
<E1BP2017_GM_SERIALNUMBER>
<xsl:attribute name="SEGMENT"><xsl:value-of select="string('1')"/></xsl:attribute>
<MATDOC_ITM>
<xsl:value-of select="string('1')"/>
</MATDOC_ITM>
<MATDOC_ITM>
<xsl:value-of select="2"/>
</MATDOC_ITM>
<xsl:for-each select="$par0/ns0:SerialNo">
<SERIALNO>
<xsl:value-of select="string(.)"/>
</SERIALNO>
</xsl:for-each>
</E1BP2017_GM_SERIALNUMBER>
</xsl:template>
<xsl:template name="agt:var16_MapToMBGMCR02_function">
<xsl:param name="par0"/>
<E1BP2017_GM_SERIALNUMBER>
<xsl:attribute name="SEGMENT"><xsl:value-of select="string('1')"/></xsl:attribute>
<MATDOC_ITM>
<xsl:value-of select="string('1')"/>
</MATDOC_ITM>
<xsl:for-each select="$par0/ns0:SerialNo">
<SERIALNO>
<xsl:value-of select="string(.)"/>
</SERIALNO>
</xsl:for-each>
</E1BP2017_GM_SERIALNUMBER>
</xsl:template>
<xsl:template match="/">
<xsl:variable name="var1_resultof_cast" select="string('1')"/>
<MBGMCR02>
<IDOC>
<xsl:attribute name="BEGIN"><xsl:value-of select="$var1_resultof_cast"/></xsl:attribute>
<EDI_DC40>
<xsl:attribute name="SEGMENT"><xsl:value-of select="$var1_resultof_cast"/></xsl:attribute>
<TABNAM>EDI_DC40</TABNAM>
<xsl:for-each select="ns0:FlexNet.BusinessFacade.Inventory.Inventory2History/ns0:SessionContext/ns0:PartnerInfo/ns0:CLNT">
<MANDT>
<xsl:value-of select="string(.)"/>
</MANDT>
</xsl:for-each>
<DIRECT>
<xsl:value-of select="string('2')"/>
</DIRECT>
<IDOCTYP>MBGMCR02</IDOCTYP>
<MESTYP>MBGMCR</MESTYP>
<xsl:for-each select="ns0:FlexNet.BusinessFacade.Inventory.Inventory2History/ns0:SessionContext/ns0:PartnerInfo/ns0:SNDPOR">
<SNDPOR>
<xsl:value-of select="string(.)"/>
</SNDPOR>
</xsl:for-each>
<xsl:for-each select="ns0:FlexNet.BusinessFacade.Inventory.Inventory2History/ns0:SessionContext/ns0:PartnerInfo/ns0:SNDPRT">
<SNDPRT>
<xsl:value-of select="string(.)"/>
</SNDPRT>
</xsl:for-each>
<xsl:for-each select="ns0:FlexNet.BusinessFacade.Inventory.Inventory2History/ns0:SessionContext/ns0:PartnerInfo/ns0:SNDPRN">
<SNDPRN>
<xsl:value-of select="string(.)"/>
</SNDPRN>
</xsl:for-each>
<xsl:for-each select="ns0:FlexNet.BusinessFacade.Inventory.Inventory2History/ns0:SessionContext/ns0:PartnerInfo/ns0:RCVPOR">
<RCVPOR>
<xsl:value-of select="string(.)"/>
</RCVPOR>
</xsl:for-each>
<xsl:for-each select="ns0:FlexNet.BusinessFacade.Inventory.Inventory2History/ns0:SessionContext/ns0:PartnerInfo/ns0:RCVPRT">
<RCVPRT>
<xsl:value-of select="string(.)"/>
</RCVPRT>
</xsl:for-each>
<xsl:for-each select="ns0:FlexNet.BusinessFacade.Inventory.Inventory2History/ns0:SessionContext/ns0:PartnerInfo/ns0:RCVPRN">
<RCVPRN>
<xsl:value-of select="string(.)"/>
</RCVPRN>
</xsl:for-each>
<xsl:for-each select="ns0:FlexNet.BusinessFacade.Inventory.Inventory2History">
<CREDAT>
<xsl:call-template name="RetreiveUnformatedDate">
<xsl:with-param name="DateValue" select="ns0:SessionContext/ns0:TransactionTime"/>
</xsl:call-template>
</CREDAT>
</xsl:for-each>
<xsl:for-each select="ns0:FlexNet.BusinessFacade.Inventory.Inventory2History">
<CRETIM>
<xsl:call-template name="RetreiveUnformatedTime">
<xsl:with-param name="DateValue" select="ns0:SessionContext/ns0:TransactionTime"/>
</xsl:call-template>
</CRETIM>
</xsl:for-each>
<xsl:for-each select="ns0:FlexNet.BusinessFacade.Inventory.Inventory2History/ns0:SessionContext/ns0:TransactionGUID">
<SERIAL>
<xsl:value-of select="string(.)"/>
</SERIAL>
</xsl:for-each>
</EDI_DC40>
<E1BP2017_GM_HEAD_01>
<xsl:attribute name="SEGMENT"><xsl:value-of select="$var1_resultof_cast"/></xsl:attribute>
<xsl:for-each select="ns0:FlexNet.BusinessFacade.Inventory.Inventory2History">
<PSTNG_DATE>
<xsl:call-template name="RetreiveUnformatedDate">
<xsl:with-param name="DateValue" select="ns0:SessionContext/ns0:TransactionTime"/>
</xsl:call-template>
</PSTNG_DATE>
</xsl:for-each>
<xsl:for-each select="ns0:FlexNet.BusinessFacade.Inventory.Inventory2History">
<DOC_DATE>
<xsl:call-template name="RetreiveUnformatedDate">
<xsl:with-param name="DateValue" select="ns0:SessionContext/ns0:TransactionTime"/>
</xsl:call-template>
</DOC_DATE>
</xsl:for-each>
<xsl:for-each select="ns0:FlexNet.BusinessFacade.Inventory.Inventory2History/ns0:SessionContext/ns0:TransactionGUID">
<REF_DOC_NO>
<xsl:value-of select="string(.)"/>
</REF_DOC_NO>
</xsl:for-each>
<xsl:for-each select="ns0:FlexNet.BusinessFacade.Inventory.Inventory2History/ns0:SessionContext/ns0:EmployeeID">
<PR_UNAME>
<xsl:value-of select="string(floor(number(string(.))))"/>
</PR_UNAME>
</xsl:for-each>
</E1BP2017_GM_HEAD_01>
<E1BP2017_GM_CODE>
<xsl:attribute name="SEGMENT"><xsl:value-of select="$var1_resultof_cast"/></xsl:attribute>
<xsl:for-each select="ns0:FlexNet.BusinessFacade.Inventory.Inventory2History/ns0:FlexNet.BusinessRules.Inventory.Inventory2History/ns0:HostTransactionCode">
<GM_CODE>
<xsl:value-of select="string(.)"/>
</GM_CODE>
</xsl:for-each>
</E1BP2017_GM_CODE>
<xsl:for-each select="ns0:FlexNet.BusinessFacade.Inventory.Inventory2History/ns0:FlexNet.BusinessRules.Inventory.Inventory2History">
<xsl:variable name="var4_cur" select="."/>
<xsl:for-each select="ns0:InventoryDetail">
<xsl:variable name="var2_resultof_map">
<xsl:for-each select="ns0:Container">
<xsl:value-of select="(string-length(string(.)) = '0')"/>
</xsl:for-each>
</xsl:variable>
<xsl:if test="string(boolean(translate(normalize-space($var2_resultof_map), 'false0 ', ''))) != 'false'">
<xsl:call-template name="agt:var3_MapToMBGMCR02_function">
<xsl:with-param name="par0" select="."/>
<xsl:with-param name="par1" select="$var4_cur"/>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
<xsl:for-each select="ns0:FlexNet.BusinessFacade.Inventory.Inventory2History/ns0:FlexNet.BusinessRules.Inventory.Inventory2History">
<xsl:variable name="var6_cur" select="."/>
<xsl:for-each select="ns0:InventoryDetail">
<xsl:variable name="var5_resultof_map">
<xsl:for-each select="ns0:Container">
<xsl:value-of select="(string-length(string(.)) = '0')"/>
</xsl:for-each>
</xsl:variable>
<xsl:if test="string(not(boolean(translate(normalize-space($var5_resultof_map), 'false0 ', '')))) != 'false'">
<E1BP2017_GM_ITEM_CREATE>
<xsl:attribute name="SEGMENT"><xsl:value-of select="$var1_resultof_cast"/></xsl:attribute>
<xsl:for-each select="ns0:ProductNo">
<MATERIAL>
<xsl:value-of select="string(.)"/>
</MATERIAL>
</xsl:for-each>
<xsl:for-each select="$var6_cur/ns0:Facility">
<PLANT>
<xsl:value-of select="string(.)"/>
</PLANT>
</xsl:for-each>
<xsl:for-each select="$var6_cur/ns0:Facility">
<STGE_LOC>
<xsl:value-of select="string(.)"/>
</STGE_LOC>
</xsl:for-each>
<xsl:for-each select="$var6_cur/ns0:ToSAPWarehouse">
<MOVE_STLOC>
<xsl:value-of select="string(.)"/>
</MOVE_STLOC>
</xsl:for-each>
<xsl:for-each select="$var6_cur/ns0:InventoryDetail/ns0:LotNo">
<BATCH>
<xsl:value-of select="string(.)"/>
</BATCH>
</xsl:for-each>
<xsl:for-each select="$var6_cur/ns0:InventoryDetail/ns0:UomCode">
<ENTRY_UOM_ISO>
<xsl:value-of select="string(.)"/>
</ENTRY_UOM_ISO>
</xsl:for-each>
<xsl:for-each select="$var6_cur/ns0:ReferenceOrderNumber">
<RESERV_NO>
<xsl:value-of select="string(.)"/>
</RESERV_NO>
</xsl:for-each>
<xsl:for-each select="$var6_cur/ns0:ReferenceOrderLineNumber">
<RES_ITEM>
<xsl:value-of select="string(.)"/>
</RES_ITEM>
</xsl:for-each>
<xsl:for-each select="$var6_cur/ns0:SerialNo">
<SERIALNO>
<xsl:value-of select="string(.)"/>
</SERIALNO>
</xsl:for-each>
<xsl:for-each select="ns0:LotNo">
<BATCH>
<xsl:value-of select="string(.)"/>
</BATCH>
</xsl:for-each>
<xsl:for-each select="ns0:HostMovementCode">
<MOVE_TYPE>
<xsl:value-of select="string(.)"/>
</MOVE_TYPE>
</xsl:for-each>
<xsl:for-each select="ns0:InventoryStatus[((floor(number(string(.))) = '1') or ((floor(number(string(.))) = '2') or (floor(number(string(.))) = '3')))]">
<STCK_TYPE>
<xsl:choose>
<xsl:when test="string((floor(number(string(.))) = '1')) != 'false'">
<xsl:value-of select="'F'"/>
</xsl:when>
<xsl:when test="string((floor(number(string(.))) = '2')) != 'false'">
<xsl:value-of select="'X'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'S'"/>
</xsl:otherwise>
</xsl:choose>
</STCK_TYPE>
</xsl:for-each>
<xsl:for-each select="ns0:HostIndicator1">
<SPEC_STOCK>
<xsl:value-of select="string(.)"/>
</SPEC_STOCK>
</xsl:for-each>
<xsl:for-each select="ns0:PartnerNo">
<VENDOR>
<xsl:value-of select="string(.)"/>
</VENDOR>
</xsl:for-each>
<xsl:for-each select="ns0:Quantity">
<ENTRY_QNT>
<xsl:call-template name="FormatNumber_3DecimalPoint">
<xsl:with-param name="Value" select="."/>
</xsl:call-template>
</ENTRY_QNT>
</xsl:for-each>
<xsl:for-each select="ns0:UomCode">
<ENTRY_UOM>
<xsl:value-of select="string(.)"/>
</ENTRY_UOM>
</xsl:for-each>
<xsl:for-each select="$var6_cur/ns0:OrderNo">
<PO_NUMBER>
<xsl:value-of select="string(.)"/>
</PO_NUMBER>
</xsl:for-each>
<xsl:for-each select="$var6_cur/ns0:OrderLineNo">
<PO_ITEM>
<xsl:value-of select="string(floor(number(string(.))))"/>
</PO_ITEM>
</xsl:for-each>
<xsl:for-each select="ns0:ReferenceOrderNumber">
<RESERV_NO>
<xsl:value-of select="string(.)"/>
</RESERV_NO>
</xsl:for-each>
<xsl:for-each select="ns0:ReferenceOrderLineNumber">
<RES_ITEM>
<xsl:value-of select="string(.)"/>
</RES_ITEM>
</xsl:for-each>
<xsl:for-each select="ns0:HostIndicator2">
<MVT_IND>
<xsl:value-of select="string(.)"/>
</MVT_IND>
</xsl:for-each>
</E1BP2017_GM_ITEM_CREATE>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
<xsl:for-each select="ns0:FlexNet.BusinessFacade.Inventory.Inventory2History/ns0:FlexNet.BusinessRules.Inventory.Inventory2History/ns0:InventoryDetail">
<xsl:variable name="var10_" select="."/>
<xsl:variable name="var9_resultof_map">
<xsl:for-each select="ns0:Container">
<xsl:variable name="var8_cur" select="."/>
<xsl:variable name="var7_resultof_map">
<xsl:for-each select="$var10_/ns0:SerialNo">
<xsl:value-of select="((string-length(string($var8_cur)) = '0') and (string-length(string(.)) > '0'))"/>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="boolean(translate(normalize-space($var7_resultof_map), 'false0 ', ''))"/>
</xsl:for-each>
</xsl:variable>
<xsl:if test="string(boolean(translate(normalize-space($var9_resultof_map), 'false0 ', ''))) != 'false'">
<xsl:call-template name="agt:var11_MapToMBGMCR02_function">
<xsl:with-param name="par0" select="."/>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="ns0:FlexNet.BusinessFacade.Inventory.Inventory2History/ns0:FlexNet.BusinessRules.Inventory.Inventory2History/ns0:InventoryDetail">
<xsl:variable name="var15_" select="."/>
<xsl:variable name="var14_resultof_map">
<xsl:for-each select="ns0:Container">
<xsl:variable name="var13_cur" select="."/>
<xsl:variable name="var12_resultof_map">
<xsl:for-each select="$var15_/ns0:SerialNo">
<xsl:value-of select="(not((string-length(string($var13_cur)) = '0')) and (string-length(string(.)) > '0'))"/>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="boolean(translate(normalize-space($var12_resultof_map), 'false0 ', ''))"/>
</xsl:for-each>
</xsl:variable>
<xsl:if test="string(boolean(translate(normalize-space($var14_resultof_map), 'false0 ', ''))) != 'false'">
<xsl:call-template name="agt:var16_MapToMBGMCR02_function">
<xsl:with-param name="par0" select="."/>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</IDOC>
</MBGMCR02>
</xsl:template>
</xsl:stylesheet>
Thanks

Re: XSLT Mapping error

Posted: Tue Jan 12, 2016 6:32 pm
by adrian
Hi,

This is a generated stylesheet (says so in the XML comment). Have you considered contacting support for the product that generated it?

The result of an XSLT transformation depends on the used input XML, more so in this case, where a generated stylesheet (usually tailored on a specific XML structure) is involved.
Do you have a sample XML for this?

Regards,
Adrian