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

Re: what does xsl:sort do if "select" doesn't evaluate

Subject: Re: what does xsl:sort do if "select" doesn't evaluate to anything?
From: bix_xslt@xxxxxxxxxxx
Date: Wed, 19 Mar 2003 01:07:19 -0600
if select
>   what is the defined behavior for <xsl:sort> if the "select="
> expression is not satisfied by anything?

I don't actually have the 'defined' answer.  I'm guessing if M. Kay didn't
specify it within his book, then it wasn't specified at the date of the
writing.

What will happen if there isn't any data associated with the select
path/contents?  Basically, the processor continues as normal.  I have a
feeling that it treats those nodes which don't contain your specific element
as an empty or zero value.  These probably go first or last when sorted for
a given order.

e.g.
<cars>
    <car>
        <displacement value = "10"/></car>
    <car>
        <displacement value = "60"/></car>
    <car/>
</cars>

~~~~~~ snip ~~~~~~

        <x:for-each select="//car">
            <x:sort data-type="number" order="descending"
select="displacement/@value"/>
               <x:copy-of select="."/>
          </x:for-each>

~~~~ output ~~~~~~

    <car>
        <displacement value = "60"/></car>
    <car>
        <displacement value = "10"/></car>
    <car></car>


-------------------------------


bix

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.