[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: sort by xsl:if and then sort using templates?

Subject: Re: sort by xsl:if and then sort using templates?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 20 Nov 2006 21:59:35 GMT
Re:  sort by xsl:if and then sort using templates?
xsl:sort have to be direct children of xsl:for-each (or
xsl:aply-templates) you can not nest in xsl:if (or anything else)
Just put the test on your select predicate or outside the xsl:apply-templates

It's a bit hard to show exactly what you need to do as I think you over
trimmed your stylesheet, but in general rather than


<xsl:apply-templates>
<xsl:if test="something">
<xsl:sort ..../>
</xsl:if>
</xsl:apply-templates>

do either

<xsl:apply-templates select="*[something]>
<xsl:sort.../>
</xsl:sort>

or 

<xsl:choose>
<xsl:when test="something">
<xsl:apply-templates>
<xsl:sort ..../>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>

depending on what you want to do if the predicate is false (no output,
or no sorting, respectively)

David

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.