What Is XSL?

As you saw in Chapter 1, XSL is essentially a formatting or text parsing language. Formatting refers to applying consistent pictures to XML data where repeated element structures of XML data can be displayed in a consistent manner. For example, a set of rows from a relational database table stored as an XML document can be very easily displayed by applying the same template to each row (see Chapter 1, Figure 1-2). A text parsing language is a programming or scripting language that can be used to filter in (or out) both wanted and unwanted data. In terms of XML documents, XSL can be used to dig down into the hierarchical tree structure of an XML document and retrieve only the elements you want to see displayed. In other words, using XSL as an XML document text parser allows you to select parts of an XML document to retrieve. For example, Figure 1-7 in Chapter 1 used an XSL style sheet templating operation to format and apply filtering, returning only the names of continents and countries , ignoring all population data.

The Roots of XSL

XSL began as just XSL. Now it seems to be called XSL, XSLT, XPath, and even XSL-FO. What are all these things?

  • XSL:  eXtensible Style Sheet Language, which is essentially an XML-based style sheet language exclusively for applying styles to XML documents. XSL is similar to CSS in function, where CSS applies styles to HTML files.

  • XSLT:  eXtensible Style Sheet Language Transformations allows transformations of XML documents into other formats, such as HTML or XHTML.

XHTML is a more restrictive and cleaner version of HTML.

  • XSL-FO:  XML Format is used to apply consistent formatting to XML documents. In some respects, XSL and XSL-FO (including XPath) are both essentially one and the same. The initial World Wide Web Consortium (W3C at www.w3c.com) defined all expression pattern matching (see XPath next ) and formatting (XML-FO) as being part and parcel of XSL. Essentially, XML-FO and XPath are splits and refinements on the original expression pattern matching and formatting contained within the original W3C definition of XSL.

  • XPath:  A scripting language that can be used to navigate through XML documents. XPath is used to apply expressions to the elements and attributes in XML documents, allowing for pattern matching filtering on the contents of XML documents. Like XML-FO, XPath is essentially a W3C definition split and refinement on the original definition of XSL.

This chapter will not cover XML-FO and XPath specifically . This chapter is all about the basics of XSL formatting and parsing of XML documents. Thus the original form of the W3C XSL definition will be used with a Microsoft bent. Once again, the subject matter of this book is XML as it relates to relational databases and native XML databases. Therefore, any coverage of XML, the XML DOM, XSL, and other tools is kept as simple as possible. This forces the focus on the database aspect of XML technology.

The objective is to demonstrate how XSL can be used to format and filter XML documents. The objective is not to describe all the miniscule details of XML and all its related tools, toys, and scripting languages. Some of these extra scripting languages are covered elsewhere in this book, at the appropriate juncture, and if applicable to the topic at hand.

XSL syntax can be divided into three general sections: elements, methods , and pattern matching characters . Lets begin with the syntax of XSL elements.



Beginning XML Databases
Beginning XML Databases (Wrox Beginning Guides)
ISBN: 0471791202
EAN: 2147483647
Year: 2006
Pages: 183
Authors: Gavin Powell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net