I retired from personal blogging in July 2008.
But you can find me over at http://blog.xero.com.

XSLT, my old friend
Posted by Rod in Old-blog-archives at 4:58 pm on Wednesday, 1 December 2004

I had to quickly knock out a website today which could be updated easily.  The data is very structured and heirachical. I needed other people to be able to easily update the content without tools and felt that it wasn’t really worth creating a database.

An XML file was the obvious solution, and I started using ASP.Net to render the XML into some pages.  The structure was quite nested and deep so it soon got complicated and I thought maybe I should use an XSLT Stylesheet to transform the data.

Under ASP.Net its really easy. Create an XML Control

<asp:Xml runat=”server” id=”xmlTransform”></asp:Xml>

And then set the XML and XSLT File (in this case in code)

With xmlTransform
   
.DocumentSource = “Resources/Source.xml”
   
.TransformSource = “Transform.xslt”
End With

I had to do a bit of googling to reacquaint myself with the XSLT commands but only took a few minutes to get back up to speed (its been a few years). 

XSLT allows you to easily reach in and grab the bits of XML data you need.  Changes to the XML data or XSLT formatting does not require a recompile.

Too easy!

Trackback uri |