Download presentation
Presentation is loading. Please wait.
Published byCecil Rafe Richards Modified over 8 years ago
1
SDPL 2004Notes 4: Intro to Style Sheets1 4. Introduction to Style Sheets n Discussed recently: –Programmatic manipulation of documents n Now a more human point of view: –How to specify the visual representation of structured documents? n Concepts, properties and requirements of style systems on a general level –later examples of concrete style languages (CSS, XSL)
2
SDPL 2004Notes 4: Intro to Style Sheets2 Introduction to Style Sheets (Inspired by Brüggemann-Klein & Wood: Electronic Style Sheets. Univ. Freiburg, Institut für Informatik, Bericht 43, 1992) n Declarative markup of structured documents indicates only the syntactic structure –no semantics (processing, formatting, …) n Electronic style sheets –specify layout and appearance of document content –e.g., Word styles, or LaTeX style files (macros), FrameMaker templates; CSS and XSL style sheets
3
SDPL 2004Notes 4: Intro to Style Sheets3 Style Sheets? n (Tyylisivu tai tyylisäännöstö) 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 2004Notes 4: Intro to Style Sheets4 Why Style Sheets? n Separation of content and presentation is a basic "dogma" in structured documenting –supports maintenance and multi-use of documents –(unnecessary complication for single-purpose or 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 2004Notes 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 “Styling = transforming + formatting” –matches Extensible Stylesheet Language: –XSL = XSLT (transformation language) + XSL FO (formatting language)
6
SDPL 2004Notes 4: Intro to Style Sheets6 Formatter (muotoilin, muotoiluohjelma) n Formatter is a device (program) capable to format a document (obviously!), which involves –hyphenation (breaking of character sequences) –typeface attribution (characters into glyphs) »e.g, single glyph for " fi" –line breaking (assembling glyphs into lines) –page breaking (grouping lines onto pages) fi
7
SDPL 2004Notes 4: Intro to Style Sheets7 Process of Transformation (muunnos) Formatter input Transformation TeX FOT (XSL formatting object tree) Style sheet - Latex style file, CSS, XSLT
8
SDPL 2004Notes 4: Intro to Style Sheets8 Process of Formatting (muotoilu) n Creates a detailed description of presentation –> style sheet may not have complete control of the final formatted presentation!
9
SDPL 2004Notes 4: Intro to Style Sheets9 Process of Rendering (hahmonnus) n Display/play the document on output medium
10
SDPL 2004Notes 4: Intro to Style Sheets10 Style Rules n Style sheet is a set of style rules –Attach transformations to document 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 have been studied –associated to occurrences of element types in the document grammar
11
SDPL 2004Notes 4: Intro to Style Sheets11 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 the context the element
12
SDPL 2004Notes 4: Intro to Style Sheets12 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 –headings numbered 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
13
SDPL 2004Notes 4: Intro to Style Sheets13 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)
14
SDPL 2004Notes 4: Intro to Style Sheets14 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
15
SDPL 2004Notes 4: Intro to Style Sheets15 Hierarchy in Formatting Document structure Formatting tasks / presentation areas create pages create block
16
SDPL 2004Notes 4: Intro to Style Sheets16 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
17
SDPL 2004Notes 4: Intro to Style Sheets17 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
18
SDPL 2004Notes 4: Intro to Style Sheets18 Numbering (2) Example of different numbering schemes: Section 1 Theorem 1, or 1.1 Figure 2, or 1, or 1.2, or 1.1 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.2, or 1.1 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
19
SDPL 2004Notes 4: Intro to Style Sheets19 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 Rearrangement not supported by the weakest style systems (e.g., CSS)
20
SDPL 2004Notes 4: Intro to Style Sheets20 Viewpoint on Style Languages n Style languages should support traditional stylistic conventions discussed above 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
© 2024 SlidePlayer.com. Inc.
All rights reserved.