Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Help! How do I sort my data, and keep the root's attributes at the same time? [Thread Next] Re: Help! How do I sort my data, and keep the root's attributes at the same time?To: NULL Date: 8/4/2004 3:02:00 AM Hi,
I don't really get what you want to do but here's a version of your
xsl that might help you a bit:
<?xml version='1.0'?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:for-each select="LABORATORY">
<LABORATORY case="{@case}" project="{@project}" Type="{@Type}">
<xsl:apply-templates select="CLIENT">
</xsl:apply-templates>
<xsl:apply-templates select="DENTALUNITS">
</xsl:apply-templates>
<xsl:for-each select="DENTALUNITS">
<xsl:sort select="substring(@date,8,2)" data-type="number"
order="ascending"/>
<xsl:sort select="substring(@date,4,3)" data-type="text"
order="ascending"/>
<xsl:sort select="substring(@date,1,2)" data-type="number"
order="ascending"/>
</xsl:for-each>
</LABORATORY>
</xsl:for-each>
</xsl:template>
<xsl:template match="LABORATORY/CLIENT">
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="LABORATORY/DENTALUNITS">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:transform>
I don't think the sorting is done correctly yet, but I think it gives
you the output you want. (You've probably figured this out for
yourself already, anyway)
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
