Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: Sort xml and output xml >Thread Next - Re: Sort xml and output xml Re: Sort xml and output xmlTo: NULL Date: 12/6/2006 8:07:00 AM
Jim Andersen wrote:
> As you can see from mr p.lepins posting the solution is far from "trivial".
I'm not sure I agree; that solution strikes me as overcomplicated for
the question you asked.
"Produce a new levelone document, copying the child elements in sorted
order."
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template select="/levelone">
<levelone>
<xsl:for-each select="child">
<xsl:sort select="@sort"/>
<xsl:copy-of select=".">
</xsl:apply-templates>
</levelone>
</xsl:template>
</xsl:stylesheet>
Yes, things may become more complicated when additional constraints are
applied... but this ought to do the job you asked for.
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
