on 04-07-2013 6:40 PM
Hi All,
Kindly help me with below mapping requirement. I have used context handling in various ways but not able to map values correctly when there are multiple values.
Also note that there can be multiple tables also.
Structure
Input data:
Output Data:
Note: Value1 and Value2 corresponds to value of Col1 and Col2 and they will always be in respective order.
Thank you all for your inputs. I have created a java mapping to handle this scenario using stax parser.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aman,
if possible can you share input and output xml?
it will be helpful to get your requirement.
Regards,
Muniyappan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sreeni,
Thanks for replying.
The column Name field in header tag is 0..unbounded. The number of columns will vary every time and so is value in accordance to it. Also table tag is 1..unbounded.
I think it was not clear by what i mentioned in the question.
I don't think the above mapping will work for my requirement.
Adjust xslt as per ur requirement:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:ns0="http://test" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<MT_Target>
<xsl:for-each select="/ns0:mt/table/Data">
<table>
<xsl:for-each select="Value">
<xsl:variable name="counter">
<xsl:value-of select="position()"/>
</xsl:variable>
<xsl:variable name="element_name">
<xsl:call-template name="element">
<xsl:with-param name="i" select="$counter"/>
</xsl:call-template>
</xsl:variable>
<xsl:element name="{$element_name}">
<xsl:value-of select="."/>
</xsl:element>
</xsl:for-each>
</table>
</xsl:for-each>
</MT_Target>
</xsl:template>
<xsl:template name="element">
<xsl:param name="i"/>
<xsl:value-of select="/ns0:mt/table/Header/Column[$i]"/>
</xsl:template>
</xsl:stylesheet>
Output:
Thanks
Amit Srivastava
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
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.