Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: XSLT question [Thread Next] Re: XSLT questionTo: NULL Date: 5/1/2008 3:46:00 PM On May 1, 4:11=A0am, Martin Honnen <mahotr...@yahoo.de> wrote: > time2...@gmail.com wrote: > > I want to transform the XML so that the result is the same except one > > of the c nodes is always returned first in the response based on a > > specfic id element (see below). > > Pass in the id of the 'c' element as a parameter and then use the > identity transformation template plus a template for 'b' elements that > ensures that the 'c' children are processed in the order you want: > > <xsl:stylesheet > =A0 =A0xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform" > =A0 =A0version=3D"1.0"> > > =A0 =A0<xsl:param name=3D"id" select=3D"3"/> > > =A0 =A0<xsl:strip-space elements=3D"*"/> > > =A0 =A0<xsl:output method=3D"xml" indent=3D"yes"/> > > =A0 =A0<xsl:template match=3D"@* | node()"> > =A0 =A0 =A0<xsl:copy> > =A0 =A0 =A0 =A0<xsl:apply-templates select=3D"@* | node()"/> > =A0 =A0 =A0</xsl:copy> > =A0 =A0</xsl:template> > > =A0 =A0<xsl:template match=3D"b"> > =A0 =A0 =A0<xsl:copy> > =A0 =A0 =A0 =A0<xsl:apply-templates select=3D"@*"/> > =A0 =A0 =A0 =A0<xsl:apply-templates select=3D"c[@id =3D $id]"/> > =A0 =A0 =A0 =A0<xsl:apply-templates select=3D"c[not(@id =3D $id)]"/> > =A0 =A0 =A0</xsl:copy> > =A0 =A0</xsl:template> > > </xsl:stylesheet> > > -- > > =A0 =A0 =A0 =A0 Martin Honnen --- MVP XML > =A0 =A0 =A0 =A0http://JavaScript.FAQTs.com/ This worked perfectly, thanks! | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
