XSLT sample
Use this sample to transform the Sync.MyRawData BOD XML to a Sync.PurchaseOrder BOD XML Document.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:extensions="http://www.infor.com/ION/XSL/extensions" exclude-result-prefixes="extensions" version="2.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="SyncMyRawData">
<SyncPurchaseOrder>
<xsl:apply-templates select="ApplicationArea"/>
<xsl:apply-templates select="DataArea"/>
</SyncPurchaseOrder>
</xsl:template>
<xsl:template match="ApplicationArea">
<xsl:element name="ApplicationArea">
<xsl:copy-of select="*"/>
</xsl:element>
</xsl:template>
<xsl:template match="DataArea">
<xsl:element name="DataArea">
<xsl:apply-templates select="Sync"/>
<xsl:apply-templates select="MyRawData/RawData"/>
</xsl:element>
</xsl:template>
<xsl:template match="Sync">
<xsl:element name="Sync">
<xsl:copy-of select="*"/>
</xsl:element>
</xsl:template>
<xsl:template match="MyRawData/RawData">
<xsl:variable name="b64" select="extensions:decodeString(string(.))"/>
<xsl:for-each select="tokenize($b64,'\|')">
<xsl:variable name="Header" select="."/>
<PurchaseOrder>
<PurchaseOrderHeader>
<DocumentID>
<xsl:value-of select="tokenize($Header,',')[position() = 1]"/>
</DocumentID>
<SupplierParty>
<Name>
<xsl:value-of select="tokenize($Header,',')[position() = 2]"/>
</Name>
</SupplierParty>
<BaseCurrencyAmount>
<Amount CurrencyID="{tokenize($Header,',')[position() = 3]}">
<!-- Business Validation Checks -->
<xsl:variable name="Amount" select="tokenize($Header,',')[position() = 4]"/>
<xsl:variable name="Amount" select="substring-before($Amount, '^')"/>
<xsl:value-of select="$Amount"/>
</Amount>
</BaseCurrencyAmount>
</PurchaseOrderHeader>
<xsl:for-each select="tokenize($Header,'\^')">
<xsl:variable name="Line" select="."/>
<xsl:if test="position() != 1">
<PurchaseOrderLine>
<ItemID>
<xsl:value-of select="tokenize($Line,'\?')[position() = 1]"/>
</ItemID>
<Description>
<xsl:value-of select="tokenize($Line,'\?')[position() = 2]"/>
</Description>
<Quantity>
<xsl:value-of select="tokenize($Line,'\?')[position() = 3]"/>
</Quantity>
</PurchaseOrderLine>
</xsl:if>
</xsl:for-each>
</PurchaseOrder>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>