Subject: [xsl] Re: Re: how to optimize recursive algorithm? From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx> Date: Sat, 29 Nov 2003 09:24:04 +0100 |
> I want to represent this document graphically (in SVG) as a tree structure > like this: > > root > |-------------<------------------| > |--- ab-------->-----------------| > |--- longname -->----- xyz-->---| > | |--- tuop-->--| > |--- last -------->----------------| > > > The problem I submitted refers to the calculation of the width of the branch > on the right hand side of each element's name (plus the first branch > represented as a path going backwards) that should be aligned to the > rightmost position for all elements. > Its total length is the maximum of the sum of the length of all elements Here you are talking about "the maximum of the sum of the length of all elements" ... ? What is a "length of an element" ? "the maximum of the sum of the length of all elements" should be just "the sum of the length of all elements" -- a sum is just a single number, it is not meningful to try to find the maximum of a single number. > residing on each "branch" plus a certain fixed amount to leave some room > between the elements. > > In this case it would be the maximum between: Now you are just looking for the maximum of several numbers, not the maximum of their sum. > the length of "ab" > the length of "longname" plus "xyz" > the length of "longname" plus "tuop". > the length of "last". > Summary: It is not clear what you want to achieve. However, I guess the following link will be useful: http://skew.org/xml/stylesheets/treeview/ascii/ Also, in case you need to find the element with the maximum depth, this question has been asked before and has a nice and efficient solution (e.g. using FXSL) -- see http://sources.redhat.com/ml/xsl-list/2002-05/msg00611.html Pardon me in case my guesses are wrong. ===== Cheers, Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Re: how to optimize recur, FC | Thread | Re: [xsl] Re: Re: how to optimize r, FC |
Re: [xsl] File management via XSLT, Nicola Martella | Date | [xsl] Re: Matching a first instance, Dimitre Novatchev |
Month |