|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Generic functions over a tree (Was: Re: Repeated Recur
Peter Doggett <ee99ppd at brunel dot ac dot uk> wrote: > Now I dont have a problem with the maths involved (I am developing > shifting and decimal to hex/binary templates).The problem is that I > cant dynamically update a variable in XSL while traversing the tree. > to call a recursive template would require me to keep track of which > <bitfield> elements I have processed? > > Any Ideas? A general solution corresponding to this very generally described problem is to use the generic tree-processing templates of FXSL, in particular "foldl-tree" http://fxsl.sourceforge.net/articles/FuncProg/3.html#Tree_processing "foldl-tree" is for trees what foldl is for lists. It traverses all nodes of a tree and applies a function to the current node and the current accumulated result. At the above link there are examples of using foldl-tree: sumtree - sums the values of all nodes of a tree producttree - calculates the product of the values of all tree nodes tree-labels-list - produces the concatenation of the labels of all nodes maptree f - produces another tree by applying f() on each node Hope this helped. ===== Cheers, Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com 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
|

Cart








