How to Transform XML With XSLT

xml code on a computer monitor

 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 declarat

Add an XSL statement.

- style sheet declarat

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 docume

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.