[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: creating XML hierarchy where not existed before??
It can be solved in XML. Basically, you can do it with recursion: For each starting element (e.g. group1), you process it by emitting the start of a element of level n, processing the input element itself, and calling a recursive template to process the following element of level n+1. The recursive template checks whether the element passed to it is of the n+1 level; if so, it processes it (probably with another pair of a level-x template and a recursive template) and calls itself with the next element. If it's level n, terminate. Control then returns to the template that called the recursive template, the closing tag of level n is output, and the template ends. Or something like this: <level1> process the group1 element call-template [process-level1] with the next element </level1> process-level1 does the following if: [group1] -> return without doing anything [group2] -> process group2, call-template level1 with the next element (forward-sibling) and so forth. Variations come from whether levels can be missing (a group4 following a group2), multiple group n's in a row, etc. Ken Meltsner 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
|