Re: distinct-values() optimization, sorting by frequen
without knowing really what the input or output looks like its a bit hard, but "want to sort by frequency of distinct-value " makes me think you want to be using xsl:for-each-group rather than distinct-values. for-each-group is much more powerful as it not only gives you the sequence of distinct values but (in curent-group()) the sequence of nodes that correspond to that value, so you can easily count them. > I have to have it for the sort, and then I have to re-do it Youshouldn't need to sort twice, you can store the sorted list using xsl:perform sort. > Actually I don't think that <xsl:sort> is doing what I want at all! :-( <xsl:for-each select="$distinct-persNames"> <xsl:sort select="count($persNames[normalize-space(lower-case(.)) = .])"/> te sort expression does not depend on the current node so it will be the same foir each item, so no sorting will be done. I suspect you intended current() rather than . but also there's no need to work out $persNames[normalize-space(lower-case(.)) for every item as you've saved these normalised results earlier haven't you? Unless saxon takes this expression out of the loop just calculating this sort expression is going to be O(n^2) before you even start sorting (I think) David ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format