1/18 ITApplications XML Module Session 5: Extensible Stylesheet Language (XSL)

Slides:



Advertisements
Similar presentations
Copyright © 2003 Pearson Education, Inc. Slide 3-1 Created by Cheryl M. Hughes The Web Wizards Guide to XML by Cheryl M. Hughes.
Advertisements

Copyright © 2003 Pearson Education, Inc. Slide 4-1 Created by Cheryl M. Hughes, Harvard University Extension School Cambridge, MA The Web Wizards Guide.
XML III. Learning Objectives Formatting XML Documents: Overview Using Cascading Style Sheets to format XML documents Using XSL to format XML documents.
HTML and CSS. HTML Hyper Text Markup Language Tells browser how to display text and images.
CSS-Formatting Review Cascading Style Sheets addstyle to your HTML web pages.
Cascading Style Sheets (CSS). Cascading Style Sheets With the explosive growth of the World Wide Web, designers and programmers quickly explored and reached.
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
Web Pages Week 10 This week: CSS Next week: CSS – Part 2.
Cascading Style Sheets
CSS Digital Media: Communication and design 2007.
Today CSS HTML A project.
Introducing CSS CIS 133 mashup Javascript, jQuery and XML 1.
CSS. Intro to CSS Cascading Style Sheets – styles and enhances appearance of webpage.css extension.
Lecture 5 Use Cases and Style Sheets
Technology Reviews :XSL Park, Ho-gun. What is XSL Extensible Style sheet LanguageExtensible Style sheet Language An XML-based language used to.
CHAPTER 8 ADVANCED CSS. LEARNING OBJECTIVES Assign formatting styles to a CSS class definition Use a tag’s class attribute to apply the styles defined.
Cascading Style Sheets. CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style to HTML elements. CSS is a.
Links.  Styling Links  Links can be styled with any CSS property (e.g. color, font-family, background-color).  Special for links are that they can.
Web Development & Design Foundations with XHTML Chapter 7 Key Concepts.
HyperText Markup Language (HTML) Uses plain text to add markup instructions to a file. If you can't produce it with a standard keyboard, it can't go into.
Cascading Style Sheets Basics. Why use Cascading Style Sheets? Allows you to set up a series of rules for all pages in a site. The series may be changed.
Cascading Style Sheets By: Valerie Kuna. What are Cascading Style Sheets? Cascading Style Sheets (CSS) are a standard for specifying the presentation.
Today’s objectives  Element relations – tree structure  Pseudo classes  Pseudo elements.
© 2004, Robert K. Moniot Chapter 6 CSS : Cascading Style Sheets.
Web Development & Design Foundations with XHTML Chapter 7 Key Concepts.
1 Web Developer & Design Foundations with XHTML Chapter 9 Key Concepts.
CSS BASICS. CSS Rules Components of a CSS Rule  Selector: Part of the rule that targets an element to be styled  Declaration: Two or more parts: a.
Building a Website: Cascading Style Sheets (CSS) Fall 2013.
1 Pengantar Teknologi Internet W03: CSS Cascading Style Sheets.
Recognizing the Benefits of Using CSS 1. The Evolution of CSS CSS was developed to standardize display information CSS was slow to be supported by browsers.
Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:
Part 3 Introduction to CSS. CSS Text Text Styles h1 {color: green} // rgb(0,255,0), #00ff00 h2{letter-spacing: 0.5cm} // 2px h3 {text-align: right} //
“Cascading Style Sheets” for styling WWW information DSC340 Mike Pangburn.
กระบวนวิชา CSS. What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to.
CSS normally control the html elements. Three Ways to Insert CSS There are three ways of inserting a style sheet: External style sheet Internal style.
Web Design with Cascading Style Sheet Lan Vu. Overview Introduction to CSS Designing CSS Using Visual Studio to create CSS Using template for web design.
Cascading style sheets CSS
Using Cascading Style Sheets CSS Basics. Goals Understand basic syntax of Cascading Style Sheets (CSS) Understand basic syntax of Cascading Style Sheets.
Cascading Style Sheets Controlling the Display Of Web Content.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 3 Style Sheets: CSS WEB.
4.01 Cascading Style Sheets
CM143 Week 4 Introducing CSS. Cascading Style Sheets A definition for the style in which an element of the webpage will be displayed Border width, colour,
Principles of Web Design 6 th Edition Chapter 4 – Cascading Style Sheets.
Week 4.  Three ways to apply CSS: Inline CSS Internal style sheets ( header style information) External style sheets.
Today’s objectives  Complete web page  Using xhtml & CSS  Adding CSS to documents Embed url(File);  CSS.
Cascading Style Sheets by Pavlovic Nenad by. Presentation Contents  What is CSS?  Why CSS?  Types of Style Sheets  Style Sheets Syntax  Box Formatting.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Tutorial 7.
CSS Tutorial 1 Introduction Syntax How to use style specifications. Styles.
Chapter 6 Introducing Cascading Style Sheets Principles of Web Design, 4 th Edition.
Cascading Style Sheets Level 2. Course Objectives, Session 1 Level 1 Quick Review Chapter 8: Adding Graphics to Web Pages Chapter 9: Sprucing Up Your.
1 Lecture 7 Style Sheets: CSS. 2 Motivation HTML markup can be used to represent –Semantics: h1 means that an element is a top-level heading –Presentation:
NASRULLAHIBA.  It is time to take your web designing skills to the next level with Cascading Style Sheets (CSS). They are a way to control the look and.
Rendering XML Documents ©NIITeXtensible Markup Language/Lesson 5/Slide 1 of 46 Objectives In this session, you will learn to: * Define rendering * Identify.
CSS Introductions. Objectives To take control of the appearance of a Web site by creating style sheets. To use a style sheet to give all the pages of.
1 Cascading Style Sheets
CSS.
Cascading Style Sheets
Creating Your Own Webpage
Web Developer & Design Foundations with XHTML
Cascading Style Sheets
Web Systems & Technologies
Cascading Style Sheets
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Software Engineering for Internet Applications
>> Dynamic CSS Selectors
Cascading Style Sheets
Cascading Style Sheets
Introduction to Cascading Style Sheets (CSS)
Presentation transcript:

1/18 ITApplications XML Module Session 5: Extensible Stylesheet Language (XSL)

2/18 Comparing XSL to CSS – Use of CSS to specify styles for HTML/XHTML Cascading Style Sheets are one way of formatting XML data (the other is using XSLT) Cascading Style Sheets are one way of formatting XML data (the other is using XSLT) CSS is used for presentation of XML data in a web browser CSS is used for presentation of XML data in a web browser As with XHTML, you specify an element and the style it should have. Example: As with XHTML, you specify an element and the style it should have. Example: title { display: block; margin: 1em; text-align:justify; color: #0000FF; } Filename: Books.css

3/18 To link a stylesheet to an XML document, you declare it as following: To link a stylesheet to an XML document, you declare it as following: <root><book> SAMS Teach Yourself XML In 21 Days SAMS Teach Yourself XML In 21 Days <publisher>SAMS</publisher> Steven Holzner Steven Holzner <isbn> </isbn><price>28.99</price></book></root> Filename: Books.xml Filename: Books.xml

4/18 You cannot specify class or id selectors in your style sheets. These are only applicable to XHTML. You cannot specify class or id selectors in your style sheets. These are only applicable to XHTML. Style rules apply only to elements. Style rules apply only to elements. Used to present XML data in a meaningful way. Used to present XML data in a meaningful way. Can be combined with other XML technologies e.g. XSLT, XLinks Can be combined with other XML technologies e.g. XSLT, XLinks Browsers have “quirks” when implementing CSS. Browsers have “quirks” when implementing CSS.

5/18 Use of XSL to specify styles for XML Elements Apply styles to all elements, specific elements or descendents of elements Apply styles to all elements, specific elements or descendents of elements Basic StyleXML Sample Basic StyleXML Sample aaa { text-align: left; aaa { text-align: left; color: blue; Letter A } color: blue; Letter A } Grouped StylesXML Sample Grouped StylesXML Sample aaa, bbb aaa, bbb { { font-family: Arial; font-family: Arial; color: green; Letter A } Letter B color: green; Letter A } Letter B

6/18 DescendentsXML Sample DescendentsXML Sample bbb ccc bbb ccc { color: red; } { color: red; } Letter B Letter B Letter C Letter C Immediate ChildrenXML Sample Immediate ChildrenXML Sample example > ccc example > ccc { color: green; { color: green; } Letter C } Letter C Letter B Letter B Letter C Letter C

7/18 Immediate Sibling Immediate Sibling aaa + bbb { aaa + bbb { border-left: 1px solid green; border-left: 1px solid green; } XML Sample XML Sample <example> Letter A Letter A Letter B Letter B Letter C Letter C </example>

8/18 CSS Attributes Elements with attributes can have rules applied to them. You can select elements with particular attributes or attribute values by the use of square brackets. Elements with attributes can have rules applied to them. You can select elements with particular attributes or attribute values by the use of square brackets. Example of an element that has an attribute: StyleXML Sample Example of an element that has an attribute: StyleXML Sample aaa[asciichar] aaa[asciichar] { { font-weight:bold; font-size:12pt; Letter A font-weight:bold; font-size:12pt; Letter A } }

9/18 Example of an element that has an attribute with a particular value: Example of an element that has an attribute with a particular value:Styleaaa[show=“no”]{ display:none; display:none;} XML Sample <example> Letter A Letter A Letter a Letter a </example>

10/18 Example of an element with an attribute value as part of a list. Example: Example of an element with an attribute value as part of a list. Example: <example> Letter A Letter A Letter B Letter B </example>aaa[tasks~=“letter”]{ color: blue;Note: attribute has value of “letter” } aaa[tasks|=“character”] aaa[tasks|=“character”] { font-weight:bold; } { font-weight:bold; } Note: attribute has a hyphen-separated list of values beginning (from the left) with “character”

11/18 CSS – Pseudo-class You can apply styles according to certain conditions specified by a pseudo-class. Syntax for pseudo-classes: selector:pseudo-class {property: value} Syntax for using a CSS class with a pseudo-class: selector.class:pseudo-class {property: value} You can apply styles according to certain conditions specified by a pseudo-class. Syntax for pseudo-classes: selector:pseudo-class {property: value} Syntax for using a CSS class with a pseudo-class: selector.class:pseudo-class {property: value}

12/18 Examples (Anchor Pseudo-classes) a:link { color: #0000FFNote: Unvisited hyperlink } Examples (Anchor Pseudo-classes) a:link { color: #0000FFNote: Unvisited hyperlink } a:visited { color: #FE0000Note: Visited hyperlink } a:hover { color: #FF00FFNote: Hover mouse over hyperlink } a:active { color: #0A00FFNote: Hyperlink was clicked }

13/18 Examples ( CSS class with a pseudo-class ) Sample Style a.blue:visited { color: #0000FF; } Sample XHTML Examples ( CSS class with a pseudo-class ) Sample Style a.blue:visited { color: #0000FF; } Sample XHTML Click Me Click Me

14/18 CSS – Pseudo-elements Apply styles according to certain conditions specified by a pseudo-element Apply styles according to certain conditions specified by a pseudo-element First Line: aaa:first-line {color:green;} First Line: aaa:first-line {color:green;} First Letter: aaa:first-letter {font-weight:bold; font-size:16pt;} First Letter: aaa:first-letter {font-weight:bold; font-size:16pt;} Before:aaa:before {content:open-quote;} Before:aaa:before {content:open-quote;} After:aaa:after {content:close-quote;} After:aaa:after {content:close-quote;}

15/18 CSS – Blocks & in-line Elements in CSS are considered block or inline, as defined by the display property. Elements in CSS are considered block or inline, as defined by the display property.

16/18 CSS – “display” property Used to specify how an element is to be displayed: Possible values are: Used to specify how an element is to be displayed: Possible values are: block block inline inline table table table-row table-row table-cell table-cell none none

17/18 CSS – Margins, Borders, Padding Margins, borders and padding can add spacing and lines around content Margins, borders and padding can add spacing and lines around content

18/18 XSL is composed of three components XSLT – used for transforming XML documents. XSLT – used for transforming XML documents. XPATH – used for addressing portions of an XML document. XPATH – used for addressing portions of an XML document. XSL-FO (Formatting Objects) – used for controlling the layout of printed documents output to a monitor, printer or other devices. XSL-FO (Formatting Objects) – used for controlling the layout of printed documents output to a monitor, printer or other devices.