Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: 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 11:47:00 AM "Joe Fawcett" <joefawcett@n...> schrieb im Newsbeitrag news:%23l9Au8xNIHA.4480@T...... > "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 > Of course my original file is well-formed. It was a typing error... It works - Thanks a lot - But I did not understand the functionality at all! Could you explain me: <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> and all the calls: <xsl:apply-templates select="@*|node()"/> Thanks again & regards, Oliver Hirschi | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
