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

Re: complicacy of sorting

Subject: Re: complicacy of sorting
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Sun, 03 Nov 2002 22:22:20 +0100
xsl sort decending
Hello Evgenia,

your code looks ok, so there is no obvious error. Maybe you can show us the according XML structure? And what's $isid? And what processor are you using? Some have problems with current() in some cases (MSXML if I recall correctly).

Furthermore you can use keys to get something like [@id = current()/@idref]. So in you case it would look like the following:

<xsl:key name="MPCs" match="MonthPriceCountryList/MonthPriceCountry" use="@CountryID"/>

This will shorten the rest of the code:

<xsl:for-each select="CountryList/Country">
  <xsl:sort select="key('MPCs', @ID)[@IStationID = $isid]/@Price"
            order="ascending"/>
  <xsl:if test="position() = 1">
    <xsl:value-of select="key('MPCs', @ID)[@IStationID = $isid]/@Price"/>
  </xsl:if>
</xsl:for-each>

This shell be at least more efficient, but it's the same logic. If current() is not the reason, this won't help you neither.

Regards,

Joerg

Evgenia Firsova wrote:
Hello.

I write this:

<xsl:for-each select="CountryList/Country">
<xsl:sort order="ascending" select="//MonthPriceCountryList/MonthPriceCountry[@CountryID=current()/@ID][
@IStationID=$isid]/@Price"/>
<xsl:if test="position()=1">
<xsl:value-of select="//MonthPriceCountryList/MonthPriceCountry[@CountryID=current()/@ID][
@IStationID=$isid]/@Price"/>
</xsl:if>
</xsl:for-each>


I need to get minimum Price from all Country (from CountryList).
Each Country has attribute ID, and each MonthPriceCountry has attribute CountryID, which are the same values.
For some reason sorting doesn't implements. Please, please, help me to find out the mistake.



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.