on 01-29-2007 9:52 PM
Hi,
I have a requirement where I want to transform the incoming XML from one structure to another (basically dropping the namespaces/prefixes etc but keeping the structure) and have reached the conclusion this can be achieved using an XSLT mapping.
Hoowever, can you please point me in the irection of some good websites that have good XSLT examples and code snippets ?
Thanks
Colin.
Hi Colin,
I have done some simple scenario regarding this XSLT mapping.This is the simple piece of code tat i have executed.Hope it will be helpful to you.And refetr to w3schools.com for more info.
?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<MT_EMP_TARGET>
<xsl:for-each select="//EMP_DATA">
<EMP_DATA>
<xsl:variable name="fname" select="//EMP_DATA/First_Name"/>
<xsl:variable name="lname" select="//EMP_DATA/Last_Name"/>
<Emp_Code><xsl:value-of select="//EMP_DATA/Emp_Code"/></Emp_Code>
<Name><xsl:value-of select="concat($fname,' ',$lname)"/></Name>
<Join_Dt><xsl:value-of select="//EMP_DATA/Join_Dt"/></Join_Dt>
<Designation><xsl:value-of select="//EMP_DATA/Level"/></Designation>
<Dept><xsl:value-of select="//EMP_DATA/Dept"/></Dept>
</EMP_DATA>
</xsl:for-each>
</MT_EMP_TARGET>
</xsl:template>
</xsl:stylesheet>
And here is my input data:
?xml version="1.0" encoding="UTF-8"?>
<MT_EMP>
<EMP_DATA>
<Emp_Code>2994</Emp_Code>
<First_Name>Gary</First_Name>
<Last_Name>Moore</Last_Name>
<Join_Dt>02/21/05</Join_Dt>
<Dept>SAP</Dept>
<Level>P3</Level>
</EMP_DATA>
<EMP_DATA>
<Emp_Code>2995</Emp_Code>
<First_Name>Dolly</First_Name>
<Last_Name>Smith</Last_Name>
<Join_Dt>12/11/06</Join_Dt>
<Dept>CSD</Dept>
<Level>P4</Level>
</EMP_DATA>
<EMP_DATA>
<Emp_Code>2996</Emp_Code>
<First_Name>Sam</First_Name>
<Last_Name>Brown</Last_Name>
<Join_Dt>04/01/05</Join_Dt>
<Dept>Java</Dept>
<Level>P3</Level>
</EMP_DATA>
<EMP_DATA>
<Emp_Code>2997</Emp_Code>
<First_Name>Kim</First_Name>
<Last_Name>Larson</Last_Name>
<Join_Dt>02/02/06</Join_Dt>
<Dept>SAP</Dept>
<Level>P3</Level>
</EMP_DATA>
</MT_EMP>
Cheers,
Prasanthi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please see the below links,
/people/prasadbabu.nemalikanti3/blog/2006/03/30/xpath-functions-in-xslt-mapping
/people/sreekanth.babu2/blog/2005/01/05/design-time-value-mappings-in-xslt
/people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping
/people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners
Regards
Chilla..
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 try to use Third pary mapping tools like stylus, altova..Try to import the source and target message xsd's into tools. Try to map the fields more similar to our GMT. There will be options for generating the XSLT either in 1.0 or 2.0 Once completed. Try to import into XI IR. Tools also provide debugging of XSLT code which will provide good understanding of the code.
Regards,
Rao.M
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can have a look at Anish's file to idoc scenario used XSLT mapping.
/people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping
for more you can have a look at :
thanks,
pooja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
go thru this- good examples-
http://w3schools.com/xsl/default.asp
check out this thread also- with editors etc
rgds,
moorthy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
go to http://www.w3schools.com/xsl/, you'll have simple and easy to understand examples
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.