XSL: Learn the Technologies for Changing and Rendering XML

Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more


XSL ( Extensible Stylesheet Language ) is a styling language for XML documents.

Most often when someone is referring to XSL, they are referring to XSLT or XSL-FO. But it also includes XPath and XQuery.

In this guide, we will discuss all of these tools, because without them, XML is really just a simple database.

HTML was designed primarily to present human-readable content on a screen, in a web browser. XML was designed to store and transfer arbitrarily structured content, primarily for consumption by an application, and frequently for presentation on a screen.

But what are you supposed to do if you want to present your XML not on a screen but on printed paper, in a book, catalog, or brochure? Or as a PDF approximation of those formats?


XSLT stands for Extensible Stylesheet Language Transformations, and is a part of XSL — along with XSL-FO, XPath, and XQuery.

The purpose of XSLT is to provide a language that can specify how to transform an XML document into another document. XSLT can be used to transform XML into another XML with a different document type definition or schema.

It can also be used to transform XML into HTML or into an XML Formatting Objects document.

General XSL and XML Guides and Tutorials

XSLT Tutorials

  • XSLT Tutorial is one of the most popular ways to learn the basics of XSLT on the web.
  • Introduction to XSLT is a detailed technical tutorial from IBM DeveloperWorks.
  • How to Transform XML is the beginning of a multi-part tutorial on XSLT, explaining how to use the language in detail.
  • XSLT Tutorial - Basics is an introductory, but fairly lengthy and detailed, tutorial explaining the purpose of XSLT and showing how to do relatively simple transformations from XML to HTML.
  • Essential XSLT is an excerpt from Steven Holzner's out of print 2001 book, Inside XSLT.
  • XML and XSLT is a short introduction to XSLT, showing a simple (but interactive) XSLT transformation.
  • How XSLT Works is an excerpt from XSLT 1.0 Pocket Reference (2005), by Evan Lenz. This is more technical tutorial than many of the other introductory pages, with lots of detailed programming information.
  • XSLT Tutorial: Advanced Features covers variables, keys, conditionals, and the difference between push and pull processing. This tutorial is from the David Birnbaum's Digital Humanties site, so the examples are drawn from XML documents relevant to humanities research.
  • What is XSLT? is a fairly extensive tutorial from O'Reilly that covers the XML background, related specifications, and has in-depth information on XSLT.
  • XSLT Introduction walks you through each aspect of the XSLT language, with a focus on programming capabilities.
  • XSLT Overview from Tutorials Point gives a high-level look at how XSLT is used.
  • Transforming XML Data with XSLT is a Java-focused tutorial on the language.
  • XSLT 1.0 and XPath 1.0 is a free 8-part tutorial on using XSLT. This is based on a more in-depth premium course with video content, which you can access from the same page.
  • Scott Penrose's XSLT Tutorial is a very practical introduction to XSLT that quickly deals with common misconceptions and questions, and provides great examples along with instructions about how to use the most popular XSLT tools.
  • XSLT Tutorial is a beginner's guide to XSLT and XML.
  • How to Create Static HTML Website With Navigation Using XSLT is a practical tutorial on transforming XML to HTML.
  • Libxslt Tutorial explains how to use the libxslt C library to transform an XML document into HTML.
  • XSLT Tutorial from ActiveState explains how to work with XSLT in the Komodo IDE.
  • XSL Languages provides an overview of how XSLT works together with XSL-FO, XPath, XQuery, XML, and other markup languages.
  • XML and XSLT Tutorial for Dreamweaver explains how to import an XML document into Dreamweaver, transform it with XSLT, and prepare it for web publishing.
  • Transforming XML with XSL describes how to use XSLT to import XML documents into InDesign.

Additional XSLT Learning Materials

XSLT Reference

Tools for Working With XSLT

XSLT Books

Why You Need XSLT

If you work with XML documents, and need a way to translate in and out of multiple formats, you should spend some time learning the ins and outs of XSL & XSLT.


HTML has virtually no support for paginated content, and non-HTML versions of XML provide no styling information at all. You can use a print-only CSS stylesheet, but that gives only rudimentary control over the print layout.

The solution starts with the relatively underused standard with huge potential, XSL-FO.

The FO stands for "Formatting Objects," and the standard is a part of XSL — eXtensible Stylesheet Language. The other two parts of the XSL standard are XSLT and XPath.

How Does XSL-FO Work?

If you are used to HTML and CSS, XSL-FO might seem a little weird. One of the most important ideas with HTML+CSS is separation of content from styling. The HTML document contains all the content, ideally without any styling or presentational information; the CSS sheet provides styling and presentation.

XSL-FO is more like a TeX/LaTeX, PostScript or Microsoft Word format — it is a page-layout format that contains both the content and the styling. An XSL-FO (or .fo ) file can be printed directly with a FO Processor.

This doesn't break the separation of concerns, though. Typically, one does not author .fo files directly. The standard method is to produce XML or (X)HTML first, either by hand or programmatically (for example, out of a database), and the use XSLT to transform the XML into XSL-FO. XSL-FO can then be consumed by an FO Processor, and turned into printed material for distribution.

XSL-FO, along with the entire XML production chain, is a highly useful tool when you have content that has to be repurposed for different media. The most common use-case is inventory information that has to be displayed in catalogs, brochures, online stores, signage, labels, packaging, and several other formats, all from a single source.

XSL-FO Tutorials

Additional XFL-FO Learning Materials

XSL-FO Tools

XSL-FO Books

  • XSL-FO (2002), by Dave Pawson, is the standard text on the subject from O'Reilly. It's highly technical, with an emphasis on generating XSL-FO by using XSLT to transform XML documents.
  • XSL Formatting Objects Developer's Handbook (2002), by Doug Lovell, is one of the first, and still one of the best, books to delve specifically into the XSL-FO markup format, instead of simply assuming all XSL-FO would be generated by XSLT transformations.
  • Definitive XSL-FO (2003), by G Ken Holman, is more of a reference book than a tutorial. It explains the W3C specification in detail, covering topics that other XSL-FO guides leave out.

XSL-FO Is No Legacy Tool

XSL-FO is one of several XML-related standards that haven't gotten as much attention since HTML and XML diverged. However, it is an extremely useful technology, and there's nothing "legacy" about it. It continues to be in heavy use in enterprise and industrial settings that need to manage content and data across multiple media and publications.


XPath is a little different and more general than XSLT and XSL-FO. It is a query language used to locate and select content in an XML or HTML document.

XPath is a more powerful alternative to CSS Selectors. While CSS Selectors are easier to use, but are not always feasible if the document author has omitted common attributes such as id and class. XPath provides a way to specify any node in a DOM tree, even without these attributes. This makes it well-suited for web scraping and document analysis.

The language got a lot of attention when it was introduced in 1999. It is still useful and thriving today, but there aren't as many contemporary tutorials as there might be. So we've collected the best available resources for learning and using XPath.

XPath Tutorials

  • XPath Tutorial from W3Schools is multi-part, in-depth explanation of XPath, with lots of practical examples and a good explanation of how XPath is related to other XML standards.
  • XPath Overview from Tutorials Point provides a easy to follow introduction to the language.
  • XPath Tutorial is a community-written tutorial on XPath basics from the Edutech Wiki.
  • The 10-Minute XPath Tutorial is a Perl-focused introduction to XPath, primarily geared toward system administrators.
  • XML XPath Tutorial is a Java-based introduction to XPath.
  • XPath Syntax is a highly technical tutorial on XPath, with a focus on .NET implementation, from Microsoft Developer Network.
  • How XPath Works is a Java-focused introduction to XPath, from Oracle.
  • What Can XPath Do for Me? is an introduction to XPath, for the benefit of mostly non-tech-savvy academics working in the humanities. This is a very good place to start if you are using XPath to query documents for scholarly research.
  • XPath Tutorial is a gentle introduction to using XPath, with a focus on searching ebook content.
  • XPath Tutorial Application is an interesting meta-tutorial from Microsoft Developer Network. It helps you learn XPath by showing how to build an application which uses XPath to teach XPath.
  • Learning XPath by Example is a visual tutorial on the language.
  • XPath for Web Scraping explains how to use XPath to programmatically extract content from web pages with Python.
  • PHP Scraping Using DOM and XPath Tutorial explains how to use XPath and PHP to programmatically extract content from web pages.
  • Mozilla Developer Network has a wide array of XPath-related documentation, tutorials, reference materials, and tools.

XPath Reference

  • XSLT and XPath Quick Reference (PDF) is a pocket reference, designed to be printed, folded, and carried with you.
  • XPath Examples is an index of example XPath expressions, with explanations.
  • XPath Locator Examples is a cookbook-style collection of XPath examples that can help you build complex and powerful XPath queries.

XPath Tools

  • Free Online XPath Tester is an online XPath tester that lets you test expressions against online document via URL.
  • XPath-Tools is a set of command-line utilities for extracting data from HTML and XML documents.
  • XPath Visualizer is a Windows desktop tool that provides a visual representation of an XML or HTML tree, and the results of XPath queries performed against it.
  • XMLSpy, an XML editor, has a built-in Xpath Editor and Debugger that provides an number of tools for working with XPath, including auto-completion, deep path suggestions, and multi-file evaluations.
  • Stylus Studio has several useful XPath tools, including a visual expression generator that will help you build an XPath query by selecting content within a document. Their XPath tutorials are also worth checking out.

XPath Libraries and Implementations

  • XPath module for the Gnome XML C Parser provides XPath support in C, and also has bindings to Python, Perl, C++, PHP, Pascal, Ruby, and Tcl.
  • XPath Library for the OCaml programming language.
  • XPath gem provides XPath support in Ruby.
  • Xpath npm package provides Xpath implementation and helpers for Node.js.
  • XPathJs is a pure JavaScript implementation of XPath, created by Google.

XPath Books

  • XPath 2.0 Programmer's Reference (2004), by Michael Kay, is the definitive classic reference work on XPath.
  • Definitive XSLT and XPath (2001), by G Ken Holman, is the authoritative guide to XPath and XSLT. It is highly technical and also provides much of the philosophical and theoretical background to how XML is designed and what is actually contained in the specifications. There are easier books for learning how to use XPath, but few that will help you really understand it in this much depth.
  • Python and XML (2001), by Jones and Drake, includes sections on using Python to query and manipulate XML documents via XPath.
  • XPath Kick Start: Navigating XML with XPath 1.0 and 2.0 (2003), by Steven Holzner, is a concise book designed for beginners.
  • XPath and XPointer: Locating Content in XML Documents (2002), by John Simpson, is a relatively short book covering XPath basics. It's speculation on the future of the standard, from its 2002 vantage point, is a little dated now, but the primary content is still highly relevant.
  • XSLT and XPath On The Edge (2001), by Jeni Tennison, is a cookbook style reference manual with tons of highly useful example queries.
  • Beginning XSLT and XPath: Transforming XML Documents and Data (2009), by Ian Williams, is a very good introduction to using XSLT and XPath. Written a few years later than most other popular books on the topic, this book has the benefit of several years of experience with the standard.

XPath Summary

XPath may not seem trendy right now. When it was first released, most people thought XML was going to become the standard language for web markup. But HTML 5 broke away from strict XML, and JSON has displaced XML as the dominant data serialization format.

However, XPath is as relevant as ever. It is still the most reliable way to query information in an XML (or HTML) document, and is the basis for XSLT. If you're interested in web scraping, web search and indexing, or document analysis, XPath continues to be an important skill.


If you work with XML documents, you will undoubtedly run into situations where you need a way to translate them into another form. Thus, it is critical to know the tools we've discussed here.

Other Interesting Stuff

We have more guides, tutorials, and infographics related to coding and development:

What Code Should You Learn?

Confused about what programming language you should learn to code in? Check out our infographic, What Code Should You Learn? It not only discusses different aspects of the languages, it answers important questions such as, "How much money will I make programming Java for a living?"

Text written by Adam Michael Wood. Compiled and edited by Frank Moraes.

Adam Michael Wood

About Adam Michael Wood

Adam specializes in developer documentation and tutorials. In addition to his writing here, he has authored engineering guides and other long-form technical manuals. Outside of work, Adam composes and performs liturgical music. He lives with his wife and children in California.


Thanks for your comment. It will show here once it has been approved.

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