6.1. Transformation Basics

XSLT stands for Extensible Stylesheet Language for Transformation, a subset of the more general stylesheet language XSL. It may seem strange at first to consider transformation a form of style application, but it will become clear when you see how it works. Like other stylesheet languages, a transformation specification is a set of rules that match elements. Each rule describes what to output based on the input data. The only difference is that XSLT produces XML as its output format.

As in earlier chapters, we'll represent XML documents as tree-shaped diagrams. Each part of the XML structure—an element, attribute, piece of text, or even comment—will be represented in a diagram as a box or node. When one part contains another, we'll draw a line descending from the parent node to the child.

There are seven different kinds of node:


The element and the root node (described shortly) share a special property among nodes: they alone can contain other nodes. An element node can contain other elements, plus any other node type except the root node. This kind of node is represented on a tree as a branching point, or as a leaf if it has no attributes or content.


It may seem strange, but an attribute is seen as a node rather than a part of its element. However, since it represents content for the element, it's seen as a separate node. The attribute node is called a leaf node because it is its own branch and has no children.


Text is another ...

Get Learning XML now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.