on 07-11-2016 12:55 PM
Dear experts
Iam getting multiple shipment items from source.I need to populate in the following way in the target.
In the target structure i have sub node document data under which two attributes are defined. I need to populate the attributes with following way
name with field name and the value with value coming from the source for that field.
Please find the attached target output expected and help me on this asap.
Regards
Nagur
Hi Nagur!
I guess XSLT transformation would be the one of the decisions in your case.
Something like this:
Source:
<?xml version="1.0" encoding="UTF-8"?>
<ns1:MT_Customers xmlns:ns1="urn:jdbc_connect">
<Customer>
<CustomerID>105</CustomerID>
<CustomerName>Item 105</CustomerName>
</Customer>
<Customer>
<CustomerID>106</CustomerID>
<CustomerName>Item 106</CustomerName>
</Customer>
<Customer>
<CustomerID>107</CustomerID>
<CustomerName>Item 107</CustomerName>
</Customer>
<Customer>
<CustomerID>108</CustomerID>
<CustomerName>Item 108</CustomerName>
</Customer>
<Customer>
<CustomerID>109</CustomerID>
<CustomerName>Item 109</CustomerName>
</Customer>
</ns1:MT_Customers>
XSL transformation:
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<Output_Message>
<xsl:apply-templates select="//Customer"/>
</Output_Message>
</xsl:template>
<xsl:template match="Customer">
<DocumentData>
<xsl:for-each select="./*">
<xsl:attribute name="{local-name()}">
<xsl:value-of select="text()"/>
</xsl:attribute>
</xsl:for-each>
</DocumentData>
</xsl:template>
</xsl:stylesheet>
Result:
<?xml version='1.0' ?>
<Output_Message>
<DocumentData CustomerID="105" CustomerName="Item 105"/>
<DocumentData CustomerID="106" CustomerName="Item 106"/>
<DocumentData CustomerID="107" CustomerName="Item 107"/>
<DocumentData CustomerID="108" CustomerName="Item 108"/>
<DocumentData CustomerID="109" CustomerName="Item 109"/>
</Output_Message>
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Nagur,
I'm not aware of a standard PI function to get the name of the source field.
So create a destination structure with multiple "node-name / value" pairs. Then in your mapping you would have to manually set the node names and map the corresponding node to the value.
Regards,
Luis
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.