Das frohe neue Jahr hat fahrt aufgenommen - es beginnt fröhlich stürmisch mit frischem Wind.
During the holidays I had some time and looked into xsl transforms again.
This time I needed a nice way to build a simple UI for a specific XML document.
My initial intention was to use a visitor pattern to transform the XML document into a corresponding Gtk UI, but then my eyes catched GtkBuilder.
GtkBuilder builds a UI from an XML definition.
And there it is, an ideal case for xslt: XSL ransform allow you to transform an XML document into some other plain-text document, this includes into other XML or - quite common - XHTML documents.
The simple document looked something like this:
<document id="document" title="About something" author="Jane Doe"> <text id="intro">Hello World.</text> <text id="more">This is something like <i>xml-to-gtk</i></text> </document>
Using this xsl stylesheet and a bit of glue, resulted in a UI looking like this:
Not pretty - but - hey - there are also other techniques that take some markup to built UIs, just think of clutter ...
Post a Comment