How to Transform XML With XSLT

xml document
kr7ysztof / Getty Images

To write XSLT code, you should have a basic understanding of HTML/XHTML, XML, XML Namespaces, XPath, and XSL. XSLT is a stylesheet that transforms XML into a new structure for use with various Internet parsers. The advancement of technology brought many different venues. The modern-day Internet user has more opportunities than ever to surf the web, such as mobile phones, iPod, Xbox and various other devices all with distinctive browser systems.

XSL Transformations (XSLT) takes well-formed XML code and transforms it into a useable format for these applications.

Beginning an XSLT Transformation

XSLT is part of an XSL style sheet. Since a style sheet uses XML syntax, you begin with an XML declaration statement.

- XML declaration

Add an XSL statement.

- style sheet declaration

Define the XSLT namespace as part of the style sheet declaration.


XSLT compares the code to a template to determine how to transform the XML. A template is a set of rules established for the style sheet. The template element uses XPath to match or associate the code. Matching may specify a child element or the entire XML document.

- designates the entire document
- this designates a child element in the document.

For example, if you have a child element called the matching code would be:

When creating XSLT, you build an output stream that is stylized and viewed on an Internet page. XSLT incorporates a number of XSL elements to define this transformation process. The next few articles will examine XSL elements used for XSLT transformations and further break down XSLT coding.

Breaking Down XSLT - XSLT Tutorials

  • How to Transform XML
  • Setting Up an XSLT Output Stream
  • How to Use the Value-of Element in XSLT
  • How to Use the For-each Element in XSLT
  • How to Filter XML Data in XSLT
  • How to Connect XML Data Files to XSLT Style Sheets
  • Key Phrases to Know for XSLT
mla apa chicago
Your Citation
Ferrara, Darla. "How to Transform XML With XSLT." ThoughtCo, Jan. 21, 2018, Ferrara, Darla. (2018, January 21). How to Transform XML With XSLT. Retrieved from Ferrara, Darla. "How to Transform XML With XSLT." ThoughtCo. (accessed February 19, 2018).