[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] extracting tree from flat xml data
Given the following xml where depth indicates the level within a tree, <data> <person> <node depth="0">granddad</node> </person> <person> <node depth="1">child 1</node> </person> <person> <node depth="1">child 2</node> </person> <person> <node depth="2">grandchild 1</node> </person> <person> <node depth="2">grandchild 2</node> </person> <person> <node depth="1">child 3</node> </person> </data> I would like to emit the following <table> <tr><td id="node_1">granddad</td></tr> <tr><td id="node_1_1"> child1</td></tr> <tr><td id="node_1_2"> child2</td></tr> <tr><td id="node_1_2_1"> grandchild 1</td></tr> <tr><td id="node_1_2_2"> grandchild 2</td></tr> <tr><td id="node_1_3"> child 3</td></tr> </table> The value for id is based on the relationship in the heirarchy. I have a JSP version of this working but need an XSLT solution also. It seems some processing of ancestors and their siblings is in order to build the value for id but the exact magic eludes me. The logic must initiated from within the 'node' template (no for-each processing by a "higher" template, ie data or person ). Any suggestions? Cheers! Larry Mason Senior Member Technical Staff i2 Technologies 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
|