Next / Previous / Contents / TCC Help System / NM Tech homepage

Abstract

Describes the XSLT language for transforming XML documents.

This publication is available in Web form and also as a PDF document. Please forward any comments to tcc-doc@nmt.edu.

Table of Contents

1. What is XSLT?
2. A brief example
3. Namespaces and XSLT
4. XPath reference
4.1. Data types in XPath
4.2. Node types
4.3. Node tests
4.4. Axis selection in XPath
4.5. XPath operators
4.6. XPath functions
4.7. Attribute value templates
5. Overall XSLT stylesheet structure
6. The root element <xsl:stylesheet>
6.1. <xsl:stylesheet> attributes
7. Top-level elements
7.1. <xsl:output>: Select output options
7.2. <xsl:preserve-space>: Preserving white space
7.3. <xsl:strip-space>: Removing non-significant white space
7.4. <xsl:import>: Use templates from another stylesheet
7.5. <xsl:key>: Create an index to optimize input document access
7.6. <xsl:decimal-format>: Define a numeric format
8. Basic template elements
8.1. <xsl:template>: Define a template
8.2. <xsl:variable>: Define a global or local variable
8.3. <xsl:apply-templates>: Process a node set with appropriate templates
8.4. <xsl:include>: Insert another stylesheet
8.5. <xsl:param>: Define an argument to be passed into a template
8.6. <xsl:with-param>: Pass an argument to a template
9. Output instructions
9.1. <xsl:text>: Output literal text
9.2. <xsl:value-of>: Output the value of an expresssion
9.3. <xsl:element>: Output an element
9.4. <xsl:attribute>: Output an attribute
9.5. <xsl:number>: Output an element number or formatted number
10. Branching elements
10.1. <xsl:for-each>: Iterate over a set of nodes
10.2. <xsl:if>: Conditional processing
10.3. <xsl:choose>: The multiple-case construct
10.4. <xsl:call-template>: Invoke another template
11. Advanced elements
11.1. <xsl:apply-imports>: Use an overridden template
11.2. <xsl:attribute-set>: Define a named attribute set
11.3. <xsl:comment>: Output a comment
11.4. <xsl:copy>: Shallow copying
11.5. <xsl:copy-of>: Deep copying
11.6. <xsl:fallback>: What to do if an extension is missing
11.7. <xsl:message>: Write a debugging message
11.8. <xsl:namespace-alias>: Assign a prefix to a namespace
11.9. <xsl:processing-instruction>: Output a processing instruction
11.10. <xsl:sort>: Process nodes in a given order
12. XSLT functions
12.1. current(): Return the current node
12.2. document(): Pull in content from other documents
12.3. format-number(): Convert a number to a string
12.4. generate-id(): Generate a unique identifier
12.5. key(): Refer to an index entry
12.6. system-property(): Return a system property value
13. Built-in templates
14. Extension elements
14.1. The exsl:document extension
15. Using the xsltproc processor

1. What is XSLT?

XSLT is a tool for transforming an XML (eXtended Markup Language) document into either an HTML document, or into an XML document of a different document type.

This document assumes that you are familiar with the structure of XML documents; if you are unfamiliar with XML, see the XML help page.

Many of the examples use HTML; for reference, see Building web pages with XHTML 1.1.

Online files related to this document:

  • model.xsl: This file is the skeleton of an XSLT stylesheet for converting an XML document to HTML. To start a new stylesheet, make a copy of this file and add your title and templates.

  • xslt.xml: The XML DocBook source file for the document you are now reading.