Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Tree List View Built with XSLT and DHTML

0.00/5 (No votes)
24 Feb 2002 1  
A tree view and list view hybrid built with XSLT and DHTML

Sample Image

Introduction

I am a Visual C++ guy. So why I am talking about XSLT and DHTML now? Sometimes, I am tired of writing C++ codes. Think about how much code you need to write when you want to sink events in ATL, how much code you need to write when you build or manipulate collections in ATL. It's too much and boring. But with DHTML, there are tons of building blocks you can use. I don't need to build a grid control, I don't need to call GDI functions. And it has flexible layout, various appearances.

This idea comes from two reasons: one is I always wanted to build a tree list view by myself, the other is I am an XSLT learner now. ADOData.xml is the XML file generated by ADO when you persist a recordset as XML. ADOData2Hier.xsl is the XSLT file for transforming XML file into HTML file and does the work of grouping data into hierarchies. You can find the grouping method in XSLT from different sources, there is an article about it in Code Project too. Source codes are short, so just see source code for details.

The platform I mentioned is the platform on which I built this. I think it should be OK if you have IE5+ and XSLT (not XSL). I never used netscape because our company and I only use IE.

The codes are just to show the idea. There are many possible improvements.

  • declare global parameters in XSLT file, in the script call addParameter to decide which fields you want to do the grouping and summation (or other aggregation).
  • any number of levels of grouping, also you can declare global parameters, but this may require more work to do.
  • there is an article "fun with tables" in MSDN, you can integrate code from that article to do some column reordering, column choosing, etc.
  • use HTML, CSS features to make the appearance more colorful.

If somebody makes improvements, don't forget to send me a copy.

http://www.visualplant.com

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here