
Extensible Stylesheet Language (XSL) - 2 - Abstract XSL is a language for expressing stylesheets. It consists of two parts: • a language for transforming XML documents, and • an XML vocabulary for specifying formatting semantics. An XSL stylesheet specifies the presentation of a class of XML documents by describing how an instance of the class is transformed into an XML document that uses the formatting vocabulary. - 3 - Contents 1 Processing a Stylesheet . 1 1.1 Introduction to stylesheet processing . 1 1.2 Tree Transformations . 1 1.3 Formatting . 2 1.4 Some test lists . 3 2 Benefits of XSL . 5 2.1 Paging and Scrolling . 5 2.2 Selectors and Tree Construction . 6 2.3 An Extended Page Layout Model . 6 2.4 A Comprehensive Area Model . 7 2.5 Internationalization and Writing-Modes . 7 2.6 Linking . 7 - 4 - More Complex XSL FO Test Document Introduction to stylesheet processing 1 Processing a Stylesheet 1.1 Introduction to stylesheet processing mandated to provide these as separate pro- An XSL stylesheet processor accepts a docu- cesses. Furthermore, implementations are free ment or data in XML and an XSL stylesheet and to process the source document in any way that produces the presentation of that XML source produces the same result as if it were processed content that was intended by the designer of that using the conceptual XSL processing model. stylesheet. There are two aspects of this presen- A diagram depicting the detailed conceptual tation process: first, constructing a result tree model is shown below. from the XML source tree andsecond, interpret- ing the result tree to produce formatted results suitable for presentation on a display, on paper, in speech, or onto other media. The first aspect is called tree transformation and the second is called formatting. The process of formatting is performed by the formatter. This format- ter may simply be a rendering engine inside a browser. Tree transformation allows the structure of the result tree to be significantly different from the structure of the source tree. For example, one 1.2 Tree Transformations could add a table-of-contents as a filtered se- lection of an original source document, or one Tree transformation constructs the result tree. could rearrange source data into a sorted tabular In XSL, this tree is called the element and at- presentation. In constructing the result tree, the tribute tree, with objects primarily in the "for- tree transformation process also adds the infor- matting object" namespace. In this tree, a for- mation necessary to format that result tree. matting object is represented as an XML ele- ment, with the properties represented by a set Formatting is enabled by including formatting of XML attribute-value pairs. The content of semantics in the result tree. Formatting se- the formatting object is the content of the XML mantics are expressed in terms of a catalog of element. Tree transformation is defined in the classes of formatting objects. The nodes of the XSLT Recommendation. A diagram depicting result tree are formatting objects. The classes this conceptual process is shown below. of formatting objects denote typographic ab- stractions such as page, paragraph, table, and so forth. Finer control over the presentation of these abstractions is provided by a set of formatting properties, such as those controlling indents, word- and letter-spacing, and widow, orphan, and hyphenation control. In XSL, the classes of formatting objects and formatting properties provide the vocabulary for express- ing presentation intent. The XSL processing model is intended to be conceptual only. An implementation is not 1 More Complex XSL FO Test Document Formatting The XSL stylesheet is used in tree transforma- that will be applied to the content of that format- tion. A stylesheet contains a set of tree con- ting object as a result of formatting the whole struction rules. The tree construction rules have result tree. Each formatting object class repre- two parts: a pattern that is matched against ele- sents a particular kind of formatting behavior. ments in the source tree and a template that con- For example, the block formatting object class structs a portion of the result tree. This allows represents the breaking of the content of a para- a stylesheet to be applicable to a wide class of graph into lines. Other parts of the specification documents that have similar source tree struc- may come from other formatting objects; for ex- tures. ample, the formatting of a paragraph (block for- matting object) depends on both the specifica- In some implementations of XSL/XSLT, the tion of properties on the block formatting object result of tree construction can be output as an and the specification of the layout structure into XML document. This would allow an XML which the block is placed by the formatter. document which contains formatting objects and formatting properties to be output. This The properties associated with an instance of capability is neither necessary for an XSL pro- a formatting object control the formatting of cessor nor is it encouraged. There are, however, that object. Some of the properties, for exam- cases where this is important, such as a server ple "color", directly specify the formatted re- preparing input for a known client; for example, sult. Other properties, for example "space-be- the way that a WAP (h tt p: / /w w w. wa p fo - fore", only constrain the set of possible format- ru m .o rg / fa q s/ in d ex . ht m ) server prepares ted results without specifying any particular for- specialized input for a WAP capable hand held matted result. The formatter may make choices device. To preserve accessibility, designers among other possible considerations such as es- of Web systems should not develop architec- thetics. tures that require (or use) the transmission of Formatting consists of the generation of a tree of documents containing formatting objects and geometric areas, called the area tree. The geo- properties unless either the transmitter knows metric areas are positioned on a sequence of one that the client can accept formatting objects and or more pages (a browser typically uses a single properties or the transmitted document contains page). Each geometric area has a position on the a reference to the source document(s) used page, a specification of what to display in that in the construction of the document with the area and may have a background, padding, and formatting objects and properties. borders. For example, formatting a single char- 1.3 Formatting acter generates an area sufficiently large enough to hold the glyph that is used to present the char- Formatting interprets the result tree in its for- acter visually and the glyph is what is displayed matting object tree form to produce the presen- in this area. These areas may be nested. For tation intended by the designer of the stylesheet example, the glyph may be positioned within a from which the XML element and attribute tree line, within a block, within a page. in the "fo" namespace was constructed. Rendering takes the area tree, the abstract model The vocabulary of formatting objects supported of the presentation (in terms of pages and their by XSL--the set of f o: element types--repre- collections of areas), and causes a presentation sents the set of typographic abstractions avail- to appear on the relevant medium, such as a able to the designer. Semantically, each format- browser window on a computer display screen tingobject represents a specificationfor a part of or sheets of paper. The semantics of rendering the pagination, layout, and styling information are not described in detail in this specification. 2 More Complex XSL FO Test Document Some test lists The first step in formatting is to "objectify" the The third step in formatting is the construction element and attribute tree obtained via an XSLT of the area tree. The area tree is generated transformation. Objectifying the tree basically as described in the semantics of each format- consists of turning the elements in the tree into ting object. The traits applicable to each for- formatting object nodes and the attributes into matting object class control how the areas are property specifications. The result of this step generated. Although every formatting property is the formatting object tree. may be specified on every formatting object, for each formatting object class, only a subset of the As part of the step of objectifying, the char- formatting properties are used to determine the acters that occur in the result tree are replaced traits for objects of that class. by f o: c ha ra c te r nodes. Characters in text nodes which consist solely of whitespace char- 1.4 Some test lists acters and which are children of elements whose An Ordered List: corresponding formatting objects do not per- 1. The 1st item in this 1st level list. mit f o :c h ar ac t er nodes as children are ig- 2. The 2nd item in this 1st level list. nored. Other characters within elements whose corresponding formatting objects do not permit a. The 1st item in this 2nd level list. fo : ch ar a ct e r nodes as children are errors. b. The 2nd item in this 2nd level list. The first phase of the Unicode Bidirectional Al- i. The 1st item inthis 3rd level list. gorithm is used to convert implicit Bidirectional ii. The 2nd item in this 3rd level markup to explicit nodes with the appropriate list. directional properties. Care is taken to insure 1. The 1st item in this 4th level that the explicit nodes so introduced are prop- list. erly nested in the formatting object tree.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages12 Page
-
File Size-