Hello,
Recently, I realized through a community discussion that to add multiple lines to a single order, I would need to manually write an XSLT.
Using my limited knowledge, I painstakingly wrote an XSLT, shedding tears along the way.
I initially wanted to tackle a SalesOrder, but due to my lack of skills, I decided to try with a simpler InventoryAdjustment instead.
I spent the entire day working on this. In the end, I managed to successfully add lines based on the line count, but the values within the lines are not being populated.
Could you kindly offer me some advice as to why this might be happening?
Here is the XSLT I wrote...
Could you please show me just one successful example of adding lines with populated values?
<xsl:stylesheet version="2.0" xmlns="">schema.infor.com/.../2" xmlns:expath-zip="">http://expath.org/ns/zip" xmlns:fn="">www.w3.org/.../xpath-functions" xmlns:dns="">schema.infor.com/.../2" xmlns:saxon="">http://saxon.sf.net/" xmlns:expath-file="">http://expath.org/ns/file" xmlns:xsi="">www.w3.org/.../XMLSchema-instance" xmlns:xsl="">www.w3.org/.../Transform" xmlns:exslt-random="">http://exslt.org/random" xmlns:exslt-common="">http://exslt.org/common" xmlns:exslt-math="">http://exslt.org/math" xmlns:xs="">www.w3.org/.../XMLSchema" xmlns:math="">www.w3.org/.../math" xmlns:map="">www.w3.org/.../map" xmlns:infor="">http://infor.com/infor-custom" exclude-result-prefixes="xs xsl fn expath-file expath-zip exslt-common exslt-math exslt-random map math saxon xsi">
<xsl:output method="xml" encoding="UTF-8" indent="no" byte-order-mark="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:if test="/*:SyncIBCTIAD">
<xsl:element name="ProcessInventoryAdjustment">
<xsl:namespace name="xs" select="'">www.w3.org/.../>
<xsl:if test="/*:SyncIBCTIAD/@languageCode">
<xsl:attribute name="languageCode">
<xsl:value-of select="/*:SyncIBCTIAD/@languageCode"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="/*:SyncIBCTIAD/@releaseID">
<xsl:attribute name="releaseID">
<xsl:value-of select="/*:SyncIBCTIAD/@releaseID"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="/*:SyncIBCTIAD/@systemEnvironmentCode">
<xsl:attribute name="systemEnvironmentCode">
<xsl:value-of select="/*:SyncIBCTIAD/@systemEnvironmentCode"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="/*:SyncIBCTIAD/@versionID">
<xsl:attribute name="versionID">
<xsl:value-of select="/*:SyncIBCTIAD/@versionID"/>
</xsl:attribute>
</xsl:if>
<xsl:copy-of select="/*:SyncIBCTIAD/*:ApplicationArea" copy-namespaces="no" />
<xsl:if test="/*:SyncIBCTIAD/*:DataArea">
<xsl:element name="DataArea">
<xsl:element name="Process">
<xsl:element name="AccountingEntityID">
<xsl:if test="/*:SyncIBCTIAD/*:DataArea/*:IBCTIAD/*:AccountingEntity">
<xsl:attribute name="accountingEntity">
<xsl:value-of select="/*:SyncIBCTIAD/*:DataArea/*:IBCTIAD/*:AccountingEntity/text()"/>
</xsl:attribute>
</xsl:if>
<xsl:value-of select="string(/*:SyncIBCTIAD/*:DataArea/*:IBCTIAD/*:AccountingEntity)"/>
</xsl:element>
<xsl:element name="LocationID">
<xsl:if test="/*:SyncIBCTIAD/*:DataArea/*:IBCTIAD/*:Location">
<xsl:attribute name="location">
<xsl:value-of select="/*:SyncIBCTIAD/*:DataArea/*:IBCTIAD/*:Location/text()"/>
</xsl:attribute>
</xsl:if>
<xsl:value-of select="string(/*:SyncIBCTIAD/*:DataArea/*:IBCTIAD/*:Location)"/>
</xsl:element>
<xsl:element name="ActionCriteria">
<xsl:element name="ActionExpression">
<xsl:attribute name="actionCode">
<xsl:value-of select="string(/*:SyncIBCTIAD/*:DataArea/*:IBCTIAD/*:ActionCode)"/>
</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:element>
<!-- Multiple InventoryAdjustmentLine based on IBCTIAD count -->
<xsl:for-each select="/*:SyncIBCTIAD/*:DataArea/*:IBCTIAD">
<xsl:element name="InventoryAdjustmentLine">
<xsl:element name="LineNumber">
<xsl:value-of select="string(/*:LineNumber)"/>
</xsl:element>
<xsl:element name="DocumentReference">
<xsl:element name="DocumentID">
<xsl:element name="ID">
<xsl:value-of select="string(/*:Lid)"/>
</xsl:element>
</xsl:element>
</xsl:element>
<xsl:element name="WarehouseLocation">
<xsl:for-each select="/*:WarehousID">
<xsl:element name="ID">
<xsl:value-of select="string(.)"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
<xsl:element name="Item">
<xsl:element name="ItemID">
<xsl:element name="ID">
<xsl:value-of select="string(/*:ItemID)"/>
</xsl:element>
</xsl:element>
<xsl:element name="SerializedLot">
<xsl:element name="Lot">
<xsl:element name="LotIDs">
<xsl:for-each select="/*:Lot">
<xsl:element name="ID">
<xsl:value-of select="string(.)"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
<xsl:if test="/*:InventoryAdjusted">
<xsl:element name="Quantity">
<xsl:attribute name="unitCode">
<xsl:value-of select="string(/*:Unit)"/>
</xsl:attribute>
<xsl:value-of select="/*:InventoryAdjusted/text()"/>
</xsl:element>
</xsl:if>
</xsl:element>
</xsl:element>
</xsl:element>
<xsl:if test="/*:InventoryAdjusted">
<xsl:element name="Quantity">
<xsl:attribute name="unitCode">
<xsl:value-of select="string(/*:Unit)"/>
</xsl:attribute>
<xsl:value-of select="/*:InventoryAdjusted/text()"/>
</xsl:element>
</xsl:if>
<xsl:element name="Facility">
<xsl:element name="IDs">
<xsl:for-each select="/*:WarehousLocation">
<xsl:element name="ID">
<xsl:attribute name="sequenceName">
<xsl:value-of select="string(ancestor::node()[1]/*:UnnamedField)"/>
</xsl:attribute>
<xsl:value-of select="string(.)"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:element>
<xsl:for-each select="/*:ReasonCode">
<xsl:element name="ReasonCode">
<xsl:value-of select="string(.)"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:if>
</xsl:element>
</xsl:if>
</xsl:template>
</xsl:stylesheet>