on 11-11-2010 6:24 AM
Hi Frnds
My I/P payload is
<?xml version="1.0" encoding="utf-8"?>
<ns0:MPRDataExport_CRM_CEZH_REC_MT xmlns:ns0="ness.com:MPRDataExport_CRM_CEZH">
<item>
<CalYearMonth>201201</CalYearMonth01>
<TotalRevenus01>592421.60</TotalRevenus01>
i want the O/P as
<?xml version="1.0" encoding="utf-8"?>
<ns0:MPRDataExport_CRM_CEZH_REC_MT xmlns:ns0="ness.com:MPRDataExport_CRM_CEZH">
<item>
<CalYearMonth01>201201</CalYearMonth01>
<CalYearMonth02>201201</CalYearMonth01>
<CalYearMonth03>201201</CalYearMonth01>
.
.
.
<CalYearMonth26>201201</CalYearMonth01>
<TotalRevenus01>592421.60</TotalRevenus01>
<TotalRevenus02>592421.60</TotalRevenus01>
<TotalRevenus03>592421.60</TotalRevenus01>
.
.
.
<TotalRevenus26>592421.60</TotalRevenus01>
I am using graphical mapping. i want to inserts numbers inside the tag in the o/p xml file.I am not aware of xslt mapping. Pls tell me how to reach this requirement.
Thanks
Vankadoath
Hi Vankadoath.N ,
You can do this requirement with Java Mapping.
where you can create a dynamic loop , to create the output like below.
for(int i=1;i<=26;i++)
output = output + "<CalYearMonth" + i + ">" + data + "</CalYearMonth" + i + ">";
The same thing can be done for all the other tags in one loop.
for i values below 10 you can format it to have 2 digits.
Or if 26 is constant, then you can manually also create a XSD to have the tags, and populate using Message mapping.
Regards,
Srivatsan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
For XSLT mapping in PI7.1 refer this:
Ur xslt will be something like this(alter it according to ur req):
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://xslt/poc">
<xsl:template match="/">
<ns0:MPRDataExport_CRM_CEZH_REC_MT >
<item>
<xsl:call-template name="Increment">
<xsl:with-param name="i">1</xsl:with-param>
<xsl:with-param name="count" select="26"/>
</xsl:call-template>
</item>
</ns0:MPRDataExport_CRM_CEZH_REC_MT >
</xsl:template>
<xsl:template name="Increment">
<xsl:param name="i"/>
<xsl:param name="count"/>
<xsl:if test="$i <= $count">
<xsl:variable name ="name" select="concat('CalYearMonth',$i)"/>
<xsl:element name="{$name}">
<xsl:value-of select="ns0:MPRDataExport_CRM_CEZH_REC_MT/item/CalYearMonth" />
</xsl:element>
</xsl:if>
<xsl:if test="$i <=$count">
<xsl:call-template name="Increment">
<xsl:with-param name="i">
<xsl:value-of select="$i + 1" />
</xsl:with-param>
<xsl:with-param name="count">
<xsl:value-of select="$count"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Refer this for xslt basics:
http://www.w3schools.com/xsl/el_element.asp
Thanks
Amit
HI Amith Thanks for the reply. I gone through the blog and i installed Altova XMLSpy and we are using XI3.0
from the blog I am not clear in the 4th page of the pdf. from the sender and receiver data types i can generate xsd files but not xsl style sheet.
My question is how to get the format of The XSL style sheet. and how to map the source and target structures in the Altova xml spy.
I am very new to xslt mapping. can you please tell me how to generate xslt code from the Altova XMLSpy.
Thanks
Vankadoath
Hi,
XML code expect the end tag it same as start tag.
But in your output structure case your XML looks like there is no end tag for every tag. So might be this is wrong structure.
But i think this below structure is possible to use by XSLT mapping
<CalYearMonth01>201201</CalYearMonth01>
<CalYearMonth02>201201</CalYearMonth02>
<CalYearMonth03>201201</CalYearMonth02>
.
.
.
<CalYearMonth26>201201</CalYearMonth026>
<TotalRevenus01>592421.60</TotalRevenus01>
<TotalRevenus02>592421.60</TotalRevenus02>
<TotalRevenus03>592421.60</TotalRevenus03>
.
.
.
<TotalRevenus26>592421.60</TotalRevenus26>
Thank you,
Sateesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.