[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: calculating the length ??
> I hope You can help me solving my problem. > > <LIST> > <ELEMENT lenght="2"/> > <ELEMENT lenght="10"/> > <ELEMENT lenght="4"/> > </LIST> > > I would like to know what the max length is for the elements, There are three solutions: 1: (with O(n^2) performance) is element[not(../element/@length > @length)] 2: (with O(n log n) performance): <xsl:for-each select="element"> <xsl:sort select="@length" data-type="number" order="descending"/> <xsl:if test="position()=1"><xsl:value-of select="@length"/></xsl:if> </xsl:for-each> 3: (with O(n) performance): write a recursive named template that processes the list of elements, at each iteration compare the length of the current element with the max of the rest of the list. Mike Kay Software AG XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|