[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XPath and recursion
Hi,
I'm pretty new to XPath and I want to achive the following. I've got an xml-file, something like this: <?xml version="1.0" encoding="UTF-8"?> <document> <node value1="DB Objects"> <node value1="Andreas"> <node value1="Peter"> <node value1="Kempten"/> <node value1="Ulperting"/> </node> <node value1="Muahhh"/> <node value1="Christoph"> <node value1="Ulperting"/> <node value1="FrankyBoy"> <node value1="Munich"/> </node> </node> </node> <node value1="Christoph"> <node value1="Munich"/> <node value1="FrankyBoy"> <node value1="Kempten"/> </node> </node> <node value1="Frank"/> </node> <node value1="Tables"> <node value1="Andreas"> <node value1="Peter"> <node value1="Munich"/> <node value1="Ulperting"/> </node> </node> ... </node> </document> And I want to get an output like this after the xsl transformation: aux1 = insFld(foldersTree, gFld("DB-Objects")) aux2 = insFld(aux1, gFld("Andreas",)) aux3 = insFld(aux2, gFld("Peter")) aux4 = insFld(aux3, gFld("Kempten")) aux4 = insFld(aux3, gFld("Ulperting")) aux3 = insFld(aux2, gFld("Muahhh")) aux3 = insFld(aux2, gFld("Christoph")) aux4 = insFld(aux3, gFld("FrankyBoy")) aux5 = insFld(aux4, gFld("Munich")) aux5 = insFld(aux4, gFld("FrankyBoy")) aux6 = insFld(aux5, gFld("Kempten")) aux6 = insFld(aux5, gFld("Kempten")) aux2 = insFld(aux1, gFld("Christoph")) aux2 = insFld(aux1, gFld("Frank")) aux3 = insFld(aux2, gFld("Peter")) aux4 = insFld(aux3, gFld("Ulperting")) aux3 = insFld(aux2, gFld("Muahhh")) aux3 = insFld(aux2, gFld("Christoph")) aux4 = insFld(aux3, gFld("Ulperting")) aux4 = insFld(aux3, gFld("FrankyBoy")) aux5 = insFld(aux4, gFld("Munich")) aux1 = insFld(foldersTree, gFld("Tables")) aux2 = insFld(aux1, gFld("Andreas",)) aux3 = insFld(aux2, gFld("Peter")) aux4 = insFld(aux3, gFld("Kempten")) aux3 = insFld(aux2, gFld("Christoph")) aux4 = insFld(aux3, gFld("Munich")) aux4 = insFld(aux3, gFld("Ulperting")) The idea behind that: if /document has at least a child, write: aux1 = insFld(foldersTreeview, gFld( "<xsl:value-of select="@value1"/>")); if the child got at least another child,write: aux2 = insFld(aux1, gFld("<xsl:value-of select="@value1"/>"); if the child of the child got at least another child,write: aux3 = insFld(aux2, gFld("<xsl:value-of select="@value1"/>"); and so on.... I tried to solve this problem for a long time now, but falways failed. Also the numbering of "aux", the deeper i get into the node-tree, is impossibly for me. Have no clue how I would do that.
_________________________________________________________________ 5 neue Buddies = 50 FreeSMS. http://messenger-mania.msn.de MSN Messenger empfehlen und kräftig abräumen! 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
|