Displaying XML lists and trees with XSL.

XSL lets us use recursion easily and naturally when we want to display recursive structures. Consider a simple way to represent lists in XML :
<list>
 <first>element</first>
 <rest>
  <list>
   <first>element</first>
   <rest/>
  </list>
 <rest>
<list>

Here is such an XML document : list.xml

Using this stylesheet we can do the following : (using sabcmd from Sablotron or any other XSL processor).

sabcmd list.xsl list.xml > list.html

The output html is here.

Now consider trees. Here is a simple XML-represented tree; here is the xsl to display it; and here is the html output.

about this demo main thx project page


Eugene Koontz