Download presentation
Presentation is loading. Please wait.
Published byHugh Caldwell Modified over 9 years ago
1
SDPL 2002Notes 4: Intro to Style Sheets1 4. Introduction to Style Sheets n Discussed recently: –Programmatic manipulation of documents n Now a more human-oriented point of view: –How to specify formatting or rendering of structured documents? n Concepts, properties and requirements of style systems on a general level –a semantic analysis of style systems –later examples of concrete style languages (CSS, XSL)
2
SDPL 2002Notes 4: Intro to Style Sheets2 Introduction to Style Sheets (Inspired by Brüggemann-Klein, A., Wood, D., Electronic Style Sheets. Universität Freiburg, Institut für Informatik, Bericht 43, Januar 1992) n Declarative markup of structured documents indicates purely syntactic structure –no semantics (processing, formatting, …) n Electronic style sheets –specify layout and appearance of document content –e.g. FrameMaker templates, Word styles, or LaTeX style files (macros); CSS and XSL style sheets
3
SDPL 2002Notes 4: Intro to Style Sheets3 Style Sheets? n In traditional publishing: set of rules about diction and language for some manuscript n Electronic style sheets –deal with graphical layout of documents (In future with aural properties, too?) –setting and changing of properties controlling layout and appearance of document content –define a mapping from documents (structure+content) to external representation on a presentation medium (paper, screen, audio, …)
4
SDPL 2002Notes 4: Intro to Style Sheets4 Why Style Sheets? n Separation of content and presentation is a basic "dogma" in structured documenting –supports longevity and multi-use of documents –(unnecessary complication for single-purpose and single-use documents) n Relationship between documents and style sheets is many-to-many –single style for many documents »supports manageability (of, say, consistent look and feel of a corporate Web site) –many styles for a single document »supports multiple output media (print, different Web clients, hand-held-devices, …)
5
SDPL 2002Notes 4: Intro to Style Sheets5 Tasks of a Style Sheet n Style sheet guides the transformation of –descriptive markup into formatter input (stream of formatting commands and text) »called transcription by Brüggemann-Klein & Wood n Formatter is a device (program) capable of –hyphenation (breaking of character sequences) –typeface attribution (characters into glyphs) »e.g, single glyph fi for " fi" –line breaking (assembling glyphs into lines) –page breaking (lines into pages)
6
SDPL 2002Notes 4: Intro to Style Sheets6 Process of Transcription/Transformation
7
SDPL 2002Notes 4: Intro to Style Sheets7 Process of Formatting n Creates a detailed description of presentation –> style sheet may not have total control of the final formatted presentation!
8
SDPL 2002Notes 4: Intro to Style Sheets8 Process of Rendering n Display/play the document on output medium
9
SDPL 2002Notes 4: Intro to Style Sheets9 Style Rules n Style sheet is a set of style rules –Attach transcriptions to logical elements n Most style rules in practise structure-based –associated to instances of element types in the document structure tree n Also grammar-based style rules –associated to occurrences of element types in the document grammar
10
SDPL 2002Notes 4: Intro to Style Sheets10 Transcription types n Fundamental operations of style rules fall into following transcription types: 1. calls of parameterised formatting tasks 2. generation of text 3. automatic numbering 4. rearrangement of elements n Application of transcriptions can depend on element context
11
SDPL 2002Notes 4: Intro to Style Sheets11 Context Specification (1) n General rule: –semantically equivalent structures (instances of the same element type) should be formatted identically n Exceptions (due to conventions, aesthetics, etc) –all paragraphs indented, except for the first one –heading numbers 1, 2, … in body but A), B), … in appendix –author lists in references: ‘‘ Aho and Ullman ’’ (just a few)‘ ‘vs Aho et al. ’’ (if several authors) –indication of target element type ( Table, Figure, Section,...) for cross references
12
SDPL 2002Notes 4: Intro to Style Sheets12 Context Specification (2) n Need access to ancestors, siblings, descendants, targets of cross references n Context conditions by a context predicate –Boolean expression built of »a reference to the current element »functions like parent, leftSibling, leftMostSibling, children, and ref –Rule applied if the context condition is true n Context specification orthogonal to transcription types (In XSL through the XPath expression language)
13
SDPL 2002Notes 4: Intro to Style Sheets13 Parameterised Formatting Tasks n The most common transcription type: n set formatting characteristics for sub-elements –typeface attribution (for strings or inline-elements) –line breaking (for paragraphs or blocks) –page breaking (for documents) –parameterised by type size, line length, indentation, page height… hierarchy of elements hierarchy of nested formatting tasks hierarchy of nested presentation areas hierarchy of elements hierarchy of nested formatting tasks hierarchy of nested presentation areas
14
SDPL 2002Notes 4: Intro to Style Sheets14 Hierarchy in Formatting Document structure Formatting tasks / presentation areas
15
SDPL 2002Notes 4: Intro to Style Sheets15 Derived or Inserted Content n boilerplate text –text not present in the source document –e.g., letter headings, © marks, bullets, … n textual content inserted at the beginning or at the end of the current element n table of contents, indexes –need to specify the source of included material
16
SDPL 2002Notes 4: Intro to Style Sheets16 Numbering (1) n Different schemes –consecutively through document »same numbering sequence, possibly common to a set of element types (e.g., for Theorems and Examples) –nested numbering for, say, nested lists »relative to occurrences of another element type higher in document hierarchy
17
SDPL 2002Notes 4: Intro to Style Sheets17 Numbering (2) Example of different numbering schemes: Section 1 Theorem 1, or 1.1 Figure 2, or 1, or 1.1, or 1.2 Section 2 Theorem 3, or 2, or 2.1 Example of different numbering schemes: Section 1 Theorem 1, or 1.1 Figure 2, or 1, or 1.1, or 1.2 Section 2 Theorem 3, or 2, or 2.1 n often via named counters with a start value and a scope (e.g., in CSS2) –In XSLT: special expressions for generating numbers
18
SDPL 2002Notes 4: Intro to Style Sheets18 Sub-element Rearrangement n Examples –reverse the order of titles and authors in references –sorting of the reference list »requires functions operating on textual contents n Sub-element suppression a special case n Not supported by the weakest style systems
19
SDPL 2002Notes 4: Intro to Style Sheets19 Viewpoint on Style Languages n Style systems should support traditional stylistic design conventions n Next a look at CSS, and later at XSL –How do the discussed concepts appear in the languages? –How do the languages support these general requirements?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.