Minimal IT logo and link to home page
Research, training, consultancy and software to reduce IT costs
Home | About | Newsletter | Contact
Previous | Next Printer friendly
7 October 2008

Why you should use XSLT

By Andrew Clifford

The XML processing language XSLT is a powerful and flexible solution to many development needs.

In the development work we do at my company, I am surprised to find one programming language is taking an ever-increasing proportion of the work. And it isn't Java, it's XSLT.

XSLT is a specialised language for converting one data structure into another. Its inputs are always XML, but its output can be anything. It can be used for a wide variety of development work: for serving web pages; as a report writer; for integrating inside and between applications; for generating test data and data loads; and for generating code.

XSLT is useful, effective and flexible.

XSLT is useful because it deals with XML. XML is a very effective way of gathering a complicated collection of data into a single lump. It is used in a large and growing proportion of IT systems. It is fundamental to the web, to systems integration, and to reporting. It is used in big and small systems - from major enterprise systems down to the files used in office applications. Even things that don't use XML, like PDF, can be built using XML tools.

XSLT is effective because it understands XML. In other languages, you process XML by querying the data structure, like standing outside a shop and trying to pick what you want by poking through the windows with a big stick. XSLT understands the data structure it is working on, more like walking through the shop and picking up what you need from the shelves. It is fundamentally different from dealing with XML in a general-purpose language.

XSLT is also effective because it is based on functional programming and pattern matching. I do not fully grasp the underlying computer science, but what I find is that programs are much more specifications of what should be achieved, rather than detailed recipes for how they should work. When you start, XSLT can be daunting, but after a while it becomes easy, powerful and surprisingly error-free. A few lines of XSLT can replace hundreds of lines of code in another language.

XSLT is very flexible. It is standards-based and cross-platform. It is supported by plenty of free and commercial tools. It can be run from the command line, in a browser, on a server, or from inside another program. It is suitable for simple one-off scripts, right up to complicated enterprise-level processing. You can even plug in other functions to extend it beyond the standard.

There are some downsides. XML and the functional programming style can be difficult to get to grips with when you start. XSLT can be slow, though it is possible to compile it where performance is critical. Being a specialised language, XSLT isn't designed to meet every programming need, and you will always need to use it in conjunction with other languages.

XSLT should be part of the toolbox of every IT developer and every IT organisation. It you are not already using it, learn it (I recommend XSLT by Doug Tidwell, ISBN 0-596-00053-7). If you are like me, you will soon find that it is the right solution to an ever-growing proportion of your development needs.

Next: System-oriented architecture (SYSOA)

Subscription

To subscribe to the newlsetter, simply send an email to newsletter-subscribe@minimalit.com.
Privacy policy

Subscribe to RSS feed

Latest newsletter:
Magical metadata

We use the term "metadata-driven" to describe IT solutions in which functionality is defined in data. Taking this to the extreme can provide unparalleled levels of speed, simplicity and versatility.
Read full newsletter

System governance

System governance helps you implement high-quality systems, manage existing systems proactively, and improve failing systems.

Try it for free!

Find out more