What Does a Stylesheet Do?

A stylesheet specifies the presentation of XML information using two basic categories of techniques:
• An optional transformation of the input document into another structure
• A description of how to present the transformed information (i.e., a specification of what properties to associate to each of the various parts of the transformed information)
As we know, XML does not use predefined tags (we can use any tag-names we like), and the meaning of these tags are not well understood.
A <table> element could mean an HTML table, a piece of furniture, or something else – and a browser does not know how to display it.
XSL describes how the XML document should be displayed!
XSLT is a language for transforming XML documents into XHTML documents or to other XML documents.
An XSLT stylesheet is an XML document, complete with elements and attributes. It has two kinds of elements, top-level and instruction. Top-level elements fall directly under the stylesheet root element.
Instruction elements represent a set of formatting instructions that dictate how the contents of an XMLdocument will be transformed. During the transformation process, XSLT analyzes the XML document, or the source tree, and converts it into a node tree, a hierarchical representation of the entire XMLdocument, also known as the result tree.
Each node represents a piece of the XML document, such as an element, attribute or some text content. The XSL stylesheet contains predefined “templates” that contain instructions on what to do with the nodes. XSLT will use the match attribute to relate XML element nodes to the templates, and transform them into the result document.