Chapter 8: Applying Styles and Transformations

 < Day Day Up > 



 Download CD Content

This chapter provides an overview of CSS and XSLT, two stylesheet languages of special importance for MathML. It summarizes the basic principles and syntax of both stylesheet languages and gives examples of their applications to MathML documents.

8.1 Introduction

When you are posting an HTML (or XHTML) document that contains MathML on a Web site, it is important to have a way of controlling the exact style in which the document will be displayed. The style of the document includes information about properties such as font size, style, color, page margins, alignment, and so on. For displaying mathematics, there are also additional style considerations, such as the size of subscripts and superscripts relative to the base or whether fractions, integrals, and sums should be shown in display or inline form.

You can use the tags and attributes provided in MathML presentation markup to specify the precise rendering for any mathematical formula in a document. However, instead of specifying styles locally for each individual expression, you can collect style information that applies to the entire document in a separate stylesheet, which is rather convenient. The stylesheet can then be stored in a central location where multiple documents on a Web site can reference it. This makes it possible to assign a consistent appearance to a related set of documents. Also, by editing the stylesheet, you can apply style changes to an entire collection of documents without having to edit each document individually.

For HTML and XML documents, two stylesheet languages are of particular importance: CSS and XSLT. These are both recommendations of the W3C and are supported by most modern browsers. A key reason for their popularity is that since they are open standards, they are not tied to a specific vendor or platform. This chapter reviews the basic concepts of CSS and XSLT and provides examples of how they can be used to control the display of MathML in Web documents.

CSS specifies a simple syntax that allows you to associate style properties with specific elements in a document. XSLT, in contrast, is a more complex but also more powerful language. In addition to its role in specifying styles, XSLT provides a general mechanism for transforming XML documents. In particular, XSLT has a variety of useful applications in the context of MathML, such as creating macros to abbreviate complex notation, defining new tags to represent concepts that are not supported by the existing MathML specification, or even translating content markup to presentation markup. We shall see examples of these uses of XSLT in Section 8.5 of this chapter.



 < Day Day Up > 



The MathML Handbook
The MathML Handbook (Charles River Media Internet & Web Design)
ISBN: 1584502495
EAN: 2147483647
Year: 2003
Pages: 127
Authors: Pavi Sandhu

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