The Transformation Process

Contact Us or call 1-877-932-8228
The Transformation Process

The Transformation Process

An XSLT looks at an XML document as a collection of nodes of the following types:

  • Root node
  • Element nodes
  • Attribute nodes
  • Text nodes
  • Processing instruction nodes
  • Comment nodes

An XSLT document contains one or more templates, which are created with the <xsl:template /> tag. When an XML document is transformed with an XSLT, the XSLT processor reads through the XML document starting at the root, which is one level above the document element, and progressing from top to bottom, just as a person would read the document. Each time the processor encounters a node, it looks for a matching template in the XSLT.

If it finds a matching template, it applies it; otherwise, it uses a default template as defined by the XSLT specification. The default templates are shown in the table below.

Default Templates
Node Type Default Template
Root Apply templates for child nodes.
Element Apply templates for child nodes.
Attribute Output attribute value.
Text Output text value.
Processing Instruction Do nothing.
Comment Do nothing.

In this context, attributes are not considered children of the elements that contain them, so attributes get ignored by the XSLT processor unless they are explicitly referenced by the XSLT document.