Hello,
I have read similar questioss/answers on the forum, but I still can't seem to get the correct results. I have a mapping which has a BOD XML input and my output is a csv file. I have most of my targets mapped now and I am trying to get data elements where I have to loop (various line items). I am trying (in this particular instance) to get the line number and I expect to get:
1
2
3
However, I am getting 3 rows
123
123
123
See below for inout and outputs when testing. Any help would be reatly appreciated.
Thank you,
Peter
Input:
</SupplierInvoiceHeader>
<SupplierInvoiceLine>
<LineNumber>1</LineNumber>
<Item>
<ItemID>
<ID lid="lid://infor.eam.eam" location="*">.25A KLDR</ID>
</ItemID>
</Item>
<Quantity unitCode="">2</Quantity>
<UnitPrice>
<Amount currencyID="USD">30</Amount>
<PerQuantity unitCode="EA">1</PerQuantity>
</UnitPrice>
<PurchaseOrderReference>
<DocumentID agencyRole="Customer">
<ID accountingEntity="UBAX" lid="lid://infor.eam.eam" location="BAXLEY">171016</ID>
</DocumentID>
<LineNumber>1</LineNumber>
</PurchaseOrderReference>
<UserArea>
<Property>
<NameValue name="eam.TypeCode">PS</NameValue>
</Property>
<Property>
<NameValue name="eam.StatusCode">M</NameValue>
</Property>
<Property>
<NameValue name="eam.ReturnQuantity">0</NameValue>
</Property>
<Property>
<NameValue name="eam.ExchangeRate">1</NameValue>
</Property>
<Property>
<NameValue name="eam.CurrencyCode">USD</NameValue>
</Property>
<Property>
<NameValue name="eam.AdjustedCost">60</NameValue>
</Property>
<Property>
<NameValue name="eam.InvoiceLineTotal">65.4</NameValue>
</Property>
<Property>
<NameValue name="eam.TaxCode">BX.GASTAX</NameValue>
</Property>
<Property>
<NameValue name="eam.TaxOrg">BAXLEY</NameValue>
</Property>
<Property>
<NameValue name="eam.Tax2Code">BX.SALEANDUSE</NameValue>
</Property>
<Property>
<NameValue name="eam.Tax2Org">BAXLEY</NameValue>
</Property>
<Property>
<NameValue name="eam.TotalExtra">0</NameValue>
</Property>
<Property>
<NameValue name="eam.TotalTaxAmount">5.4</NameValue>
</Property>
<Property>
<NameValue name="eam.InvoiceType">I</NameValue>
</Property>
<Property>
<NameValue name="eam.InvoiceReturnFlag">false</NameValue>
</Property>
<Property>
<NameValue name="eam.CostCode">720256-UBAX-1-10-GENZGLASSES</NameValue>
</Property>
<Property>
<NameValue name="eam.OrderedQuantity">2.000000</NameValue>
</Property>
<Property>
<NameValue name="eam.ReceivedQuantity">2.000000</NameValue>
</Property>
<Property>
<NameValue name="eam.TotalInvoicedQuantity">2</NameValue>
</Property>
<Property>
<NameValue name="eam.UDFCHAR10" type="StringType">720256</NameValue>
</Property>
<Property>
<NameValue name="eam.UDFCHAR11" type="StringType">UBAX</NameValue>
</Property>
<Property>
<NameValue name="eam.UDFCHAR12" type="StringType">10</NameValue>
</Property>
<Property>
<NameValue name="eam.UDFCHAR15" type="StringType">GENZGLASSES</NameValue>
</Property>
<Property>
<NameValue name="eam.UDFCHAR16" type="StringType">1</NameValue>
</Property>
<Property>
<NameValue name="eam.UDFCHKBOX01" type="IndicatorType">false</NameValue>
</Property>
<Property>
<NameValue name="eam.UDFCHKBOX02" type="IndicatorType">false</NameValue>
</Property>
<Property>
<NameValue name="eam.UDFCHKBOX03" type="IndicatorType">false</NameValue>
</Property>
<Property>
<NameValue name="eam.UDFCHKBOX04" type="IndicatorType">false</NameValue>
</Property>
<Property>
<NameValue name="eam.UDFCHKBOX05" type="IndicatorType">false</NameValue>
</Property>
<Property>
<NameValue name="eam.PrePaymentFlag">false</NameValue>
</Property>
<Property>
<NameValue name="eam.FinalPaymentFlag">false</NameValue>
</Property>
<Property>
<NameValue name="eam.PaymentNumber">1</NameValue>
</Property>
</UserArea>
</SupplierInvoiceLine>
<SupplierInvoiceLine>
<LineNumber>2</LineNumber>
<Item>
<ItemID>
<ID lid="lid://infor.eam.eam" location="*">.2A SLOW BLOW FUSE</ID>
</ItemID>
</Item>
Output:
<Project>123</Project>
<Project>123</Project>
<Project>123</Project>
<ProjectCategoryId>TBD</ProjectCategoryId>
XSLT:
<xsl:for-each select="/*:SyncSupplierInvoice/*:DataArea/*:SupplierInvoice/*:SupplierInvoiceLine">
<xsl:if test="/*:SyncSupplierInvoice/*:DataArea/*:SupplierInvoice/*:SupplierInvoiceLine">
<xsl:element name="Project">
<xsl:value-of select="/*:SyncSupplierInvoice/*:DataArea/*:SupplierInvoice/*:SupplierInvoiceLine/*:LineNumber/text()"/>
</xsl:element>
</xsl:if>
</xsl:for-each>
Image if this helps:
