xsl-list
[Top] [All Lists]

Complex Sorting Help

2006-02-25 17:01:47
In the following example, I am trying to return the Property with the cheapest 
TOTAL rate first. 
What I WANT to do is something like, this, but of course it doesn't work...
Any ideas how to get the desired results?

XML:
<Properties>
        <Property Name="My Hotel">
                <Room Name="King Room">
                        <Day Date="04/15/2006" Quantity="2" Price="180.00"/>
                        <Day Date="04/15/2006" Quantity="2" Price="180.00"/>
                        <Day Date="04/15/2006" Quantity="2" Price="100.00"/>
                </Room>
                <Room Name="Suite">
                        <Day Date="04/15/2006" Quantity="2" Price="280.00"/>
                        <Day Date="04/15/2006" Quantity="2" Price="280.00"/>
                        <Day Date="04/15/2006" Quantity="2" Price="240.00"/>
            </Room>
        </Property>
        <Property Name="Other Hotel">
            <Room Name="Queen Room">
                        <Day Date="04/15/2006" Quantity="2" Price="150.00"/>
                        <Day Date="04/15/2006" Quantity="2" Price="165.00"/>
                        <Day Date="04/15/2006" Quantity="2" Price="165.00"/>
            </Room>
        </Property>
</Properties>



XSL:
<xsl:for-each select="Property">
<xsl:sort order="ascending" data-type="number" select="Room/sum(Day/@Price)"/>
       <br/><br/>
       <xsl:value-of select="@Name"/> <br/>
       
       <xsl:for-each select="Room">
                   &#160; <xsl:value-of select="@Name"/> : 
                        <xsl:value-of select="sum(Day/@Price)"/>
       </xsl:for-each>
</xsl:for-each>



DESIRED RESULTS:
My Hotel
 King Room: 460.00
 Suite: 800.00

Your Hotel
 Queen Room: 480.00



 



--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>