Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating an unordered html list from a recursive xml document

Status
Not open for further replies.

thestonefox

Technical User
Mar 14, 2003
2
GB
Hi all

I have an xml document that contains n level of nodes and i want to display a html unordered list from them

the xml looks like this

<nodes>
<node>
<data>Node A</data>
<node>
<data>Node A1</data>
</node>
<node>
<data>Node A2</data>
</node>
<node>
<data>Node A3</data>
</node>
</node>
<node>
<data>Node B</data>
<node>
<data>Node B1</data>
</node>
<node>
<data>Node B2</data>
<node>
<data>Node B2i</data>
</node>
<node>
<data>Node B2ii</data>
</node>
</node>
<node>
<data>Node B3</data>
</node>
</node>
</nodes>

And i want it to output as an html unordered list like this.

* Node A
* Node A1
* Node A2
* Node A3
* Node B
* Node B1
* Node B2
* Node B2i
* Node B2ii
* Node B3

I've found ways of appending the nodes as i go down so i can print out the list and give the impression of indendation, but i cannot figure out how to create the relevant recursive xpath queries to display the ul and li tags correctly.

Can anyone help?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top