Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - I need help with xsl-transformation >Thread Next - Re: I need help with xsl-transformation Re: I need help with xsl-transformationTo: NULL Date: 12/5/2007 9:14:00 AM "Oliver Hirschi" <no-reply@F...> wrote in message news:5rn72eF13hp3pU1@m...... > Hi > > Can someone help me out as to how I can transform the following XML... > ----------- > <Source> > One <AAA>Two <BBB>Three <CCC>Four</CCC></BBB></AAA> > </Destination> > ----------- > into this... > ----------- > <Destination> > One <DDD>Two <EEE>Three <FFF>Four</FFF>></EEE></DDD> > </Destination> > ----------- > > - The elements could be any inteleaved... > - Is there a recursive function needed? > - How do I do that? > > Great thanks & regards, > -- > Oliver Hirschi > http://www.FamilyHirschi.ch Assuming your original file is actually well-formed, ie. a Source element as the root element then I would look at identity template, but how do the mappings work, is AAA always turned into DDD etc? <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="Source"> <Destination> <xsl:apply-templates select="@*|node()"/> </Destination> </xsl:template> <xsl:template match="AAA"> <DDD> <xsl:apply-templates select="@*|node()"/> </DDD> </xsl:template> <!-- other override templates here --> </xsl:stylesheet> -- Joe Fawcett (MVP - XML) http://joe.fawcett.name | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
