|
How to transform XML documents. these options fall into three categories: - XML-related libraries added to general purpose programming languages such as Java, Perl, Visual Basic, Python, and C++
- languages such as Omnimark and Balise designed specifically for manipulating XML (and, typically, SGML) documents
- XSLT lets you convert XML documents into other XML documents, into HTML documents, or into almost anything you like
WHAT IS XSLT Extensible Stylesheet Language Transformations (XSLT) is a language that lets you convert XML documents into other XML documents, into HTML documents, or into almost anything you like. When you specify a series of XSLT instructions for converting a class of XML documents, you do so by creating a “stylesheet,” an XML document that uses specialized XML elements and attributes that describe the changes you want made. The definition of these specialized elements and attributes comes from the World Wide Web Consortium (W3C), the same standards body responsible for XML and HTML. Why is XSLT necessary? XML’s early users were excited about their new ability to share information, but they gradually realized that sharing this information often assumed that both sharing parties used the same schema or DTD—a lot to assume. Assembling a schema that both parties could agree on was a lot of trouble, especially if they didn’t need to exchange information often. XSLT solves this problem by providing an easy, W3C-sanctioned way to convert XML documents that conform to one schema into documents that conform to others, making information much easier to pass back and forth between different systems. XSLT was originally part of the Extensible Stylesheet Language (XSL). In fact, XSLT is still technically a part of XSL. The XSL specification describes XSL as a language with two parts: a language for transforming XML documents and an XML vocabulary for describing how to format document content. This vocabulary is a collection of specialized elements called “formatting objects,” which specify page layout and other presentation-related details about the text marked up with these elements’ tags: font family, font size, margins, line spacing, and other settings. Because a powerful formatting language should let you rearrange your input document in addition to assigning these presentation details, the original XSL specification included specialized elements that let the stylesheet delete, rename, and reorder the input document’s components. As they worked on this collection of elements,the W3C XSL Working Group saw that it could be useful for much more than converting documents into formatting object files—that it could convert XML documents into almost anything else. They called this transformation language XSLT and split it out into its own separate specification, although the XSL specification still said that everything in the XSLT specification was considered to be part of the XSL specification as well.
|