Learn XML Programming

What is the eXtensible Stylesheet Language, or XSL?

The eXtensible Stylesheet Language, henceforth referred to as XSL, is a programming language that is used to create XML Stylesheets or XSS.  XSL allows XML data to be used by the stylesheet itself, creating a more dynamic end result.  Since the stylesheet can use the data, it can in turn manipulate and arrange the data before it even reaches the end user… meaning that you have a lot more control over the data.  You can even transform XML into HTML!

Of course, using XSL is somewhat different than using CSS.  The first major difference comes when declaring the XML processor… using cats.xml as an example, if you were using XSL instead of CSS, your processor declaration would look more like this:

<?xml-stylesheet type=”text/xsl” href=”cats.xsl”?>

As you can see, the main difference here is the change from the letters “CSS” to “XSL”.  Of course, they are different file types, so this is a significant difference… even if it just seems like you’re only changing a few letters around.

XSL is a much more powerful language than CSS.  Though they do share some features in common, XSL has additional processing commands that can be applied and is more capable at making changes to the document as a whole than CSS could ever be.

Whereas a sample CSS file might look like this:

      color: red;
      font-size: 10pt;
display: block;
      color: blue;
      font-size: 12pt;
      color: yellow;
      font-size: 12pt;
      color: gray;
      font-size: 11pt;

A sample XSL document might look like this:

<?xml version=”1.0″?>

<html xsl:version=”1.0″>

<body style=”font-family:Arial,helvetica,sans-serif;font-size:10pt; background-color: blue”>

<xsl:for-each select=”cats”>

<div style=”background-color:white;color:white”>

<span style=”color:black”>

<xsl:value-of select=”name” />


<xsl:value-of select=”color” />


<div style=”font-size:10pt; color: orange”>

<xsl:value-of select=”size” />

<span style=”font-style:italic”>


<xsl:value-of select=”weight” />







As you can see, that’s quite some difference in formatting.  After all, the XSL stylesheet is actually an XML document, with HTML implemented in it as well! And while both CSS and XSL do have elements in common, the elements of XSL pages are much more open to change and interpretation by the programmer.  Don’t worry if it looks too advanced for you, either… even basic programming can seem intimidating at first, but as you work on it more you’ll find that it’s actually quite easy.

Leave a Reply

Your email address will not be published. Required fields are marked *