[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: Rashmi Rubdi <dev_subscriptions@xxxxxxxxx>
Date: Mon, 20 Nov 2006 16:52:55 -0800 (PST)
xsl if sort
I'm also learning XSLT and XPath, it definitely needs to be understood from
scratch even though I have background knowledge of several other programming
languages. 
XSLT and XPath are quite different but very interesting.

I
started with these tutorials here, they give a good foundation, but they're
terse.
http://www.w3schools.com/xsl/
http://www.w3schools.com/xpath/
Practicing on smaller and simpler examples on your own also helps in
discovering and understanding it. I'm now reading few books on XSLT2.0 to
understand it properly.

But if you have any questions big or small don't
hesitate to ask here, if they are not already answered.

-Cheers
Rashmi

-----
Original Message ----
From: Max Bronsema <max.bronsema@xxxxxxxxx>
To:
xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Sent: Monday, November 20, 2006 6:05:37 PM
Subject: Re:  sort by xsl:if and then sort using templates?


Thank you
for the guidance Rashmi and David,

I seem to not be able to wrap my head
around how the XSLT processor
works, I will be doing some reading and then
getting back at this
problem.

Thanks again,

Max Bronsema


On 11/20/06,
David Carlisle <davidc@xxxxxxxxx> wrote:
>
> 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
>
>
>
>
>
>
>
--~------------------------------------------------------------------
>
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> To
unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
> or e-mail:
<mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
> --~--
>
>
Reply         
Reply to all Reply to allForward Forward Print Add Rashmi to
Contacts
list Delete this message Report phishing Show original Message text
garbled?
    Rashmi Rubdi <dev_subscriptions@xxxxxxxxx>     
to xsl-list
show details
     12:53 pm (2 hours ago)
Which version of XSLT/XPATH? I dont
think you can compare dates with >
in XPATH1.0

You can't nest xsl:sort inside
xsl:if.
xsl:if can only be nested under <xsl:apply-templates> and
<xsl:for-each>

I think if you represent dates in the standard format for
example:
2005-05-07T19:30:00  instead of 05/07/2005 you can simply sort dates
without having to extract the substrings of year, month and day with
reference
to the code snippet you have provided.

like this:
<xsl:apply-templates>
<xsl:sort select="date"/>
</xsl:apply-templates>
__________________________________________________
Do You Yahoo!?
Tired of
spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com

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.