Skip to content

Cory Foy

Organizational agility through intersecting business and technology

Menu
  • FASTER Fridays
  • Mapping Mondays
  • Player Embed
  • Search Videos
  • User Dashboard
  • User Videos
  • Video Category
  • Video Form
  • Video Tag
Menu

Creating a threaded comment generator with XSL

Posted on November 23, 2004 by Cory Foy

I got an email from a friend of mine who is building a BBS app that he wants to have threaded comments. Basically:

– This is the top post

   – This is the reply to the top

      – This is the reply to the reply

He’s using classic ASP, and was looking for a way to avoid having to do a recursive query to get the information. At first I was thinking of some SQL strategies to help avoid it but then thought that XML might be a good answer to it.

XML Document:





   
      Top Level Thread

      I'm a top level thread

   

   
      Top Level Thread2

      I'm a top level2 thread

   

   
      Mid Level Thread

      I'm a mid level thread

   

   
      Mid Level Thread

      I'm a mid level thread

   

   
      Mid Level Thread

      I'm a mid level thread

   

   
      Mid Level Thread

      I'm a mid level thread

   

   
      Top Level Thread3

      I'm a top level3 thread

   

XSL Document:







   

      

         Cool BBS

      

      

         

Here is some cool BBS type stuff:

         

      


   



   


       

          

  •       

             

          


       

       



   

   


       

          

  •       

             

          


       

       



Output:



     

  • I'm a top level thread
  •  


         

    • Mid Level Thread
    •    


              

      • Mid Level Thread
      •    

         

    • Mid Level Thread
    •  

© 2025 Cory Foy | Powered by Superbs Personal Blog theme