[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: finding out distinct node/values
> And, please, hit me over the head: where is the second (hidden?) loop > that would make this O(n^2)? Here: >> > <xsl:for-each select="/table/rows/row/name"> >> > <xsl:if test="not(. = preceding::name)"> If that is test=". = key(....)[1]" then for every n you are doing 1 comparison. If you use the preceding axis: test="not(. = preceding::name)" then for every n, you are doing n comparisons (well n - 1) so thats where the n^2 comes from. I guess it might be more apparent if written like this: <xsl:for-each select="/table/rows/row/name"> <xsl:for-each select="preceding::name"> <!-- do comparison --> cheers -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/
|
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
|