Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - XSL - conditional sort [Thread Next] Re: XSL - conditional sortTo: NULL Date: 1/12/2009 7:03:00 PM Andy Chambers wrote:
> I'd like to sort a nodelist using a sort key or just leave the
> nodelist in document order if any of the nodes lack the specified sort
> key. Is it possible to do this using just the select attribute on an
> xsl:sort?
I think you need an xsl:choose e.g.
<xsl:choose>
<xsl:when test="/nodes/node/@rank[not(normalize-space())]">
<xsl:apply-templates select="/nodes/node"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="/nodes/node">
<xsl:sort select="@rank" data-type="number"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
--
Martin Honnen
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
