Applying Style to XML
Because XML largely represents information, it is separated from how that information is to be displayed and represented to the end user. HTML is a language that strongly connects its metadata with presentation. For example, the <hr> element always displays a horizontal rule. However, there is no such limitation for the <horizontal_rule> element in XML, which can be displayed as a horizontal, vertical, or diagonal line, a string of asterisks, an image of the prime minister, or anything at all! Therefore, styling and presentation-level specificity needs to be applied to XML.In HTML, the concept of applying style sheets to further abstract the presentation layer was introduced in the form of Cascading Style Sheets (CSS). The intent was to provide a mechanism to allow for the flexible display of HTML across multiple devices, browsers, and display formats. Of course, because XML doesn’t have any presentation capability at all, it makes sense to use a similar approach. XML borrows from this concept; the result is the XML Stylesheet Language (XSL). In XML, no element includes a notion of how it is to be displayed, but XSL provides a mechanism to convert the XML element to a visual or other rendition for output. XSL can convert an XML document into HTML, SGML, RTF, another XML format, or any other file format possible. In this method, XML truly separates its content from presentation by providing an abstraction as to how the information specified is to be displayed.