SlideShare a Scribd company logo
Displaying XML Documents Using CSS and XSL Chapter 3
Review-1 A well-formed document is one that conforms to the basic rules of XML. A valid document is well formed and is also validated against a DTD. The DTD specifies the grammatical structure of an XML document, thereby allowing XML parsers to understand and interpret the document’s contents. The use of the SYSTEM keyword indicates to the parser that this is an external declaration, and that the set of rules for this XML document can be found in a specified file. EMPTY element-content type specifies that the element has no child elements or character data.
Review-2 #CDATA means that the element contains character data that is not to be parsed by a parser. #PCDATA means that the element contains data that is to be parsed by a parser.  Specifying a default value for an attribute in the DTD ensures that the attribute will get a value, even if the author of the XML document does not include it. Specifying the value of an attribute as ‘Implied’ means that the particular attribute is not mandatory and can be specified in the XML document.  Specifying the value of an attribute as ‘Required’ means that the particular attribute is mandatory (that is, its value must be provided in the XML document).
Review-3 ‘ ID’ is the identifier type, and should be unique. This attribute value is used to search for a particular instance of an element. Each element can only have one attribute of type ID.  A DTD can be either  External  or Internal.   Entities allow us to create an alias to some large piece of text, so that, in the document, the same piece of text can be referred to, simply by referring to the alias.  Namespaces allow us to combine documents from different sources, and be able to identify which elements or attributes come from which source.
Objectives Display an XML document in a browser Identify the style rules of CSS Discuss different patterns and templates of XSL Apply different styles to XML elements using CSS and XSL Transform XML documents into HTML documents using XSLT Identify the differences between CSS and XSL
Style Sheets - 1 An XML document can be displayed in different formats in different display devices such as computer, printer, and the like. Document to be displayed
Style Sheets - 2 A Style sheet is a set of instructions to display the documents: It separates presentation layer from the content data of the document. A single XML document can have multiple style sheets Style   sheets Data Presentation Layer
Style Sheets - 3 A few style sheets available in the market include: CSS- Cascading Style Sheets XSL-eXtensible Style sheet Language DSSL-Document Style Semantics and    Specification Language
Uses of CSS and XSL Cascading style sheet is used to   manipulate Visibility of an element Positioning and sizing of elements Colors and Background Font and Text Spacing XSL is used for formatting and converting documents written in one XML DTD into another DTD.
XML and Style Sheets XML documents are plain text files. The style sheets are used to format and view the XML document. Two commonly used style sheets with XML are: CSS - an extension of HTML XSL - an XML specific styling language
Working of XML XML File CSS (XML + CSS) aware Browser Formatted Document
Displaying an XML Document Using CSS -1 XML document <?xml version='1.0'?> <?xml-stylesheet type=&quot;text/css&quot; href=&quot;hello.css&quot;?> <xsampdoc> <greeting>Hello, <extension>there!</extension> </greeting>   <answer>   <ans>Good <extension>morning!</extension> </ans>   <question> How are you?  </question>  </answer> </xsampdoc>
Displaying an XML Document Using CSS -1 Xsampdoc {  margin-top:.7in; margin-bottom: .7in; margin-left:1.5in; margin-right:1in; color: navy; background-color:white; display: block  } greeting {  display:block; font-family: Arial, Helvetica, sans-  serif;font-size: 32pt; width: 30em; color: red  } question {  display:block; font-size: x-large; color: black;  } answer.ans  { display : block; font-size: 20pt; color: blue }   The CSS document for the XML document
Displaying an XML Document Using CSS -2 OUTPUT
CSS Style Rules The Syntax for style rules in a Cascading Style Sheet is:  Selector{declaration} The selector identifies the tag to which the style applies. The declaration provides the style rules applied to the selector. This is referred as ‘Simple Selector’. Example:  greeting {display:block;font-family: Arial, Helvetica,sans-serif; font-size: 32pt;  width: 30em;  color:  red }
Multiple Selector Used to apply the same style rule for different elements Syntax: selector,selector…….{declaration} Example greeting,question {font-family: sans-serif;  font-size: 32pt;  } Style Rule Selector 1 Selector 2 The same Style Rule is being used by Selector1 and Selector2
Contextual Selectors -1 It helps us to differentiate between the different occurrence of a tag. MADE IN U.S.A tag Occurrence 1 Occurrence 2 Occurrence 1 tag([declaration]} Occurrence 2 tag([declaration]} Conceptual Selector
Contextual Selectors -2 Example: <xsampdoc> <greeting>Hello! <extension>there</extension></greeting> <answer> <ans>Fine<extension>here</extension></ans> <ans>Thank you.</ans> </answer> </xsampdoc>   Contextual Selectors to differentiate between the different occurrences of <extension> greeting extension{[declarations]} answer ans extension{[declaration]}
Characters used in CSS Separates multiple selectors in a style rule   Comma , Identifies selector context   Period . Separates multiple property/value combinations   Semicolon ; Separates property and its value   Colon : Function Name Character
Linking the CSS to XML The Cascading style sheet has to be referenced in the XML document. We use a processing instruction to do so. Syntax: <?xml-stylesheet type=“text/css”  href=“url”?> Example <?xml-stylesheettype=&quot;text/css“  href=&quot;hello.css&quot;?>
Properties and Values A value of the CSS styling property may be a string, a number with a unit, an integer, or a color value. Values can be absolute or relative, inheritable or non-inheritable. Example Absolute value P{margin-left:3cm;} A margin of 3 centimeter is created irrespective of the margin size. Example Relative value P{margin-left:10%} A margin of 10% of the width of the page is created.
Color Values XML supports the following color values:   Gray White Red Short form #888 #FFF #F00 Decimal Integer rgb(136,136,136) rgb(255,255,255) rgb(255,0,0) Percentage rgb(55%,55%,55%) rgb(100%,100%,100%) rgb(100%,0,0)
Formatting the Text - 1 The CSS properties allow to specify the font in which an element will be displayed, its size and color.  <absolute-size> and <relative-size>  keywords are used with font properties <absolute-size> xx-small x-small small medium <relative-size> large smaller
Formatting the Text - 2 The different font properties that can be set are: font-family font-size font-style font-weight font-variant Font
Boxes -1 Blocks of text can be contained in a box. The following three properties apply to the boxes: Margins Border Padding Padding is the distance between the contents of the adjacent box. Margin is the distance between the border and the outer edge of the adjacent box, or between the border and its containing box.
Boxes -2 Border
Margins, Border and Padding The padding property is used to specify the distance or space between the border and its contents.  Boxes margin-top margin-bottom margin-left margin-right margin Margins Border border-top border-bottom border-left border-right border padding-bottom padding-top padding-right padding-left padding Padding
Controlling Layout The CSS layout properties can control the box on the screen.  The boxes can be overlapped using the z-index property. A paragraph that is two inches by one inch and with a scroll bar is displayed
XSL It is a style sheet application created specifically for XML. Features of XSL include: It provides a transformation language (XSLT). XSL can be used as a formatting language. XSL can be used to sort  and filter. XSL can be used for pattern matching to find records.
XSL  - 2 XML Document XSL HTML document displayed in the Web HTML CSS
Example for XSL  The XSL style sheet code <html>  <head>  <title>Icons In Cricket</title>  </head>  <body>  <h2>Icons In Cricket</h2>  <table border=&quot;2&quot; cellpadding=&quot;3&quot;>  <tr>  <td>Player</td>    <td>No. Of Catches</td>  <td>No. Of 100's</td>  <td>No. Of 50's</td>  </tr>  <xsl:for-each select=&quot;cricket/player&quot; order-by =&quot;-catches&quot;> <tr>  <td><xsl:value-of select=&quot;name&quot;/></td>  <td><xsl:value-of select=&quot;no_50&quot;/></td> <td><xsl:value-of select=&quot;no_100&quot;/></td>  <td><xsl:value-of select=&quot;catches&quot;/></td> </tr>  </xsl:for-each>  </table>  </body>  </html>
Patterns The patterns supported in XSL are: Sorting Operators Filtering Letters after sorting
Sorting The default sorting is ascending order.  The ‘-’ sign is used to sort in descending order. The chart is organized in the descending order of catches
Operators XSL supports the se operators: / ./ // .// * @ = /*/name */* @* //name
Filtering and Logical Operators Filter operations can contain expression such as Boolean expression, AND, OR, and NOT expressions The different logical operators that can be used  are: Operator Description AND Logical and OR Logical or NOT Negation = Equal != Not equal > Greater than < Less than >= Greater than or equal to <= Less than or equal
Templates Templates are the instructions in an XSL style sheet, which control the conversion of element and its content. It is represented by  <xsl:template>…</xsl:template> It is applied with the  <xsl:apply-templates/>  element The template has two parts: The matching  part The processing part  Matching part Processing part
Types of Matching Matching Matching by name Matching by ancestry Matching several names Matching the root Wildcard matches Matching by ID Matching by attributes
Handling Expressions XSL supports five types of Expressions. These are: Node Sets Booleans Strings Numbers Result Tree Fragments
Switching Styles Data Islands 1 XML document Data Islands 2 Data Islands 3 XML document with XSL style sheet 1 XML document with XSL style sheet 2 XML document with XSL style sheet 3
xsl:import and xsl:include Style sheets created by other developers can be imported using the xsl:import   The syntax for importing style sheets is: <xsl:import href= ‘another stylesheet.xsl’/> <xsl:import href= ‘another stylesheet1.xsl’/> All the different style sheets imported are arranged in an import tree.   A new node is created in the import tree when a style sheet is imported
Difference Between XSL and CSS It transforms XML into structures such as lists or tables It does not change the structure of the document XSLT lets us to map a certain pattern in the source document CSS determines the visual appearance of a page XSL provides means of transforming of XML documents CSS work by assigning a set of display properties to an HTML element
Summary-1 XML is portable. An XML document can be sent from one system to another, and even from application to application, without modifying the content. A style sheet is a set of instructions to display documents.  Style sheets can be written in several languages. Two of these are:
Cascading Style Sheets  (CSS), an extension of HTML  eXtensible Stylesheet Language  (XSL), an XML specific styling language  The selector identifies the tag to which the style applies, and the declaration provides the style rules applied, to the selector .
Summary-2 The list of selectors includes Simple selectors, Contextual selectors and Multiple selectors. Contextual Selectors help to differentiate between the different occurrences of a tag. The Multiple Selector is used to assign the same style rule to different elements. One declaration can be applied to several selectors. A block of text can be contained in a box, and this box can then be placed on the browser. The three properties that apply to the boxes are: margins, borders and padding
The CSS layout properties can control the layout of the box on the screen.  Boxes can be overlapped using the z-index property. This specifies the height and width for a box. XSL is a style sheet language created specifically for XML. It is used to convert XML documents into HTML. Cascading style sheets are applied to the resulting HTML documents for display on the web.
Summary-3 The instructions that control how an element and its content should be converted in an XSL style sheet, are called templates. XSL provides support for the following patterns: Sorting Operators Filtering A typical template element looks like this: <xsl:template match = &quot;myElement&quot;> Types of Matching Matching by attribute Matching by ID Matching by wildcard  Matching by root Matching by name

More Related Content

What's hot (20)

Xml presentation
Xml presentationXml presentation
Xml presentation
Miguel Angel Teheran Garcia
 
MYSQL - PHP Database Connectivity
MYSQL - PHP Database ConnectivityMYSQL - PHP Database Connectivity
MYSQL - PHP Database Connectivity
V.V.Vanniaperumal College for Women
 
HTML Tags
HTML TagsHTML Tags
HTML Tags
Pranay Agrawal
 
Control structure C++
Control structure C++Control structure C++
Control structure C++
Anil Kumar
 
ch01-Internet & Web Basics &.ppt
ch01-Internet & Web Basics &.pptch01-Internet & Web Basics &.ppt
ch01-Internet & Web Basics &.ppt
GmachImen
 
Introduction to JavaScript Basics.
Introduction to JavaScript Basics.Introduction to JavaScript Basics.
Introduction to JavaScript Basics.
Hassan Ahmed Baig - Web Developer
 
Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to xml
Gtu Booker
 
Xml namespace
Xml namespaceXml namespace
Xml namespace
GayathriS578276
 
XML Schema
XML SchemaXML Schema
XML Schema
yht4ever
 
Xslt
XsltXslt
Xslt
Mahara Jothi
 
css.ppt
css.pptcss.ppt
css.ppt
bhasula
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
Dr. C.V. Suresh Babu
 
Xml
XmlXml
Xml
Santosh Pandey
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
Introduction to ajax
Introduction  to  ajaxIntroduction  to  ajax
Introduction to ajax
Pihu Goel
 
Html table tags
Html table tagsHtml table tags
Html table tags
eShikshak
 
Visual Basic Controls ppt
Visual Basic Controls pptVisual Basic Controls ppt
Visual Basic Controls ppt
Ranjuma Shubhangi
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
eShikshak
 
Javascript
JavascriptJavascript
Javascript
Nagarajan
 
WSDL
WSDLWSDL
WSDL
Akshay Ballarpure
 

Viewers also liked (13)

Nếu con em vị nói lắp
Nếu con em vị nói lắpNếu con em vị nói lắp
Nếu con em vị nói lắp
Bình Trọng Án
 
Php & web server performace
Php & web server performacePhp & web server performace
Php & web server performace
Tuyển Đoàn
 
PHP Training: Module 1
PHP Training: Module 1PHP Training: Module 1
PHP Training: Module 1
hussulinux
 
Jaxb
JaxbJaxb
Jaxb
Manav Prasad
 
Xml material
Xml materialXml material
Xml material
prathap kumar
 
Tìm hiểu về NodeJs
Tìm hiểu về NodeJsTìm hiểu về NodeJs
Tìm hiểu về NodeJs
Bình Trọng Án
 
XSLT
XSLTXSLT
XSLT
Surinder Kaur
 
Dtd
DtdDtd
Dtd
Manish Chaurasia
 
PHP Custom Web application development
PHP Custom Web application developmentPHP Custom Web application development
PHP Custom Web application development
Marion Welch
 
XML Schema
XML SchemaXML Schema
XML Schema
Kumar
 
XSLT
XSLTXSLT
XSLT
rpoplai
 
Template Design for SAGD
Template Design for SAGDTemplate Design for SAGD
Template Design for SAGD
AVEVA Group plc
 
Introduction to Web Architecture
Introduction to Web ArchitectureIntroduction to Web Architecture
Introduction to Web Architecture
Chamnap Chhorn
 
Ad

Similar to Displaying XML Documents Using CSS and XSL (20)

5 xsl (formatting xml documents)
5   xsl (formatting xml documents)5   xsl (formatting xml documents)
5 xsl (formatting xml documents)
gauravashq
 
Cmsc 100 xhtml and css
Cmsc 100 xhtml and cssCmsc 100 xhtml and css
Cmsc 100 xhtml and css
MaeEstherMaguadMaralit
 
Xml
XmlXml
Xml
guestcacd813
 
XML/XSLT
XML/XSLTXML/XSLT
XML/XSLT
thinkahead.net
 
EXtensible Markup Language
EXtensible Markup LanguageEXtensible Markup Language
EXtensible Markup Language
Prabhat gangwar
 
eXtensible Markup Language (By Dr.Hatem Mohamed)
eXtensible Markup Language (By Dr.Hatem Mohamed)eXtensible Markup Language (By Dr.Hatem Mohamed)
eXtensible Markup Language (By Dr.Hatem Mohamed)
MUFIX Community
 
Xml and Co.
Xml and Co.Xml and Co.
Xml and Co.
Findik Dervis
 
Unit3wt
Unit3wtUnit3wt
Unit3wt
vamsitricks
 
Unit3wt
Unit3wtUnit3wt
Unit3wt
vamsi krishna
 
Rendering XML Documents
Rendering XML DocumentsRendering XML Documents
Rendering XML Documents
yht4ever
 
light_xml
light_xmllight_xml
light_xml
Jennifer Power
 
O9xml
O9xmlO9xml
O9xml
Ergoclicks
 
Publishing xml
Publishing xmlPublishing xml
Publishing xml
Kumar
 
M.FLORENCE DAYANA WEB DESIGN -Unit 5 XML
M.FLORENCE DAYANA WEB DESIGN -Unit 5   XMLM.FLORENCE DAYANA WEB DESIGN -Unit 5   XML
M.FLORENCE DAYANA WEB DESIGN -Unit 5 XML
Dr.Florence Dayana
 
Markup Documents
Markup DocumentsMarkup Documents
Markup Documents
Steven Cahill
 
Xml session05
Xml session05Xml session05
Xml session05
Niit Care
 
WT UNIT-2 XML.pdf
WT UNIT-2 XML.pdfWT UNIT-2 XML.pdf
WT UNIT-2 XML.pdf
Ranjeet Reddy
 
Xml
XmlXml
Xml
Abhishek Kesharwani
 
Sgml and xml
Sgml and xmlSgml and xml
Sgml and xml
Jaya Kumari
 
chapter 4 web authoring unit 4 xml.pptx
chapter 4 web authoring  unit 4 xml.pptxchapter 4 web authoring  unit 4 xml.pptx
chapter 4 web authoring unit 4 xml.pptx
amare63
 
Ad

More from Bình Trọng Án (18)

A Developer's Guide to CQRS Using .NET Core and MediatR
A Developer's Guide to CQRS Using .NET Core and MediatRA Developer's Guide to CQRS Using .NET Core and MediatR
A Developer's Guide to CQRS Using .NET Core and MediatR
Bình Trọng Án
 
Bài giảng chuyên đề - Lê Minh Hoàng
Bài giảng chuyên đề - Lê Minh HoàngBài giảng chuyên đề - Lê Minh Hoàng
Bài giảng chuyên đề - Lê Minh Hoàng
Bình Trọng Án
 
Clean code-v2.2
Clean code-v2.2Clean code-v2.2
Clean code-v2.2
Bình Trọng Án
 
Các câu chuyện toán học - Tập 3: Khẳng định trong phủ định
Các câu chuyện toán học - Tập 3: Khẳng định trong phủ địnhCác câu chuyện toán học - Tập 3: Khẳng định trong phủ định
Các câu chuyện toán học - Tập 3: Khẳng định trong phủ định
Bình Trọng Án
 
Luyện dịch Việt Anh
Luyện dịch Việt AnhLuyện dịch Việt Anh
Luyện dịch Việt Anh
Bình Trọng Án
 
2816 mcsa--part-11--domain-c111ntroller--join-domain-1
2816 mcsa--part-11--domain-c111ntroller--join-domain-12816 mcsa--part-11--domain-c111ntroller--join-domain-1
2816 mcsa--part-11--domain-c111ntroller--join-domain-1
Bình Trọng Án
 
LinQ to XML
LinQ to XMLLinQ to XML
LinQ to XML
Bình Trọng Án
 
Chuyên đề group policy
Chuyên đề group policyChuyên đề group policy
Chuyên đề group policy
Bình Trọng Án
 
Chapter 4 xml schema
Chapter 4   xml schemaChapter 4   xml schema
Chapter 4 xml schema
Bình Trọng Án
 
Tỷ lệ vàng - một phát hiện vĩ đại của hình học
Tỷ lệ vàng - một phát hiện vĩ đại của hình họcTỷ lệ vàng - một phát hiện vĩ đại của hình học
Tỷ lệ vàng - một phát hiện vĩ đại của hình học
Bình Trọng Án
 
Attributes & .NET components
Attributes & .NET componentsAttributes & .NET components
Attributes & .NET components
Bình Trọng Án
 
Ajax Control ToolKit
Ajax Control ToolKitAjax Control ToolKit
Ajax Control ToolKit
Bình Trọng Án
 
Linq intro
Linq introLinq intro
Linq intro
Bình Trọng Án
 
Sách chữa tật nói lắp Version 1.0 beta
Sách chữa tật nói lắp Version 1.0 betaSách chữa tật nói lắp Version 1.0 beta
Sách chữa tật nói lắp Version 1.0 beta
Bình Trọng Án
 
Mô hình 3 lớp
Mô hình 3 lớpMô hình 3 lớp
Mô hình 3 lớp
Bình Trọng Án
 
Xsd examples
Xsd examplesXsd examples
Xsd examples
Bình Trọng Án
 
Tp2
Tp2Tp2
Tp2
Bình Trọng Án
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
Bình Trọng Án
 
A Developer's Guide to CQRS Using .NET Core and MediatR
A Developer's Guide to CQRS Using .NET Core and MediatRA Developer's Guide to CQRS Using .NET Core and MediatR
A Developer's Guide to CQRS Using .NET Core and MediatR
Bình Trọng Án
 
Bài giảng chuyên đề - Lê Minh Hoàng
Bài giảng chuyên đề - Lê Minh HoàngBài giảng chuyên đề - Lê Minh Hoàng
Bài giảng chuyên đề - Lê Minh Hoàng
Bình Trọng Án
 
Các câu chuyện toán học - Tập 3: Khẳng định trong phủ định
Các câu chuyện toán học - Tập 3: Khẳng định trong phủ địnhCác câu chuyện toán học - Tập 3: Khẳng định trong phủ định
Các câu chuyện toán học - Tập 3: Khẳng định trong phủ định
Bình Trọng Án
 
2816 mcsa--part-11--domain-c111ntroller--join-domain-1
2816 mcsa--part-11--domain-c111ntroller--join-domain-12816 mcsa--part-11--domain-c111ntroller--join-domain-1
2816 mcsa--part-11--domain-c111ntroller--join-domain-1
Bình Trọng Án
 
Tỷ lệ vàng - một phát hiện vĩ đại của hình học
Tỷ lệ vàng - một phát hiện vĩ đại của hình họcTỷ lệ vàng - một phát hiện vĩ đại của hình học
Tỷ lệ vàng - một phát hiện vĩ đại của hình học
Bình Trọng Án
 
Attributes & .NET components
Attributes & .NET componentsAttributes & .NET components
Attributes & .NET components
Bình Trọng Án
 
Sách chữa tật nói lắp Version 1.0 beta
Sách chữa tật nói lắp Version 1.0 betaSách chữa tật nói lắp Version 1.0 beta
Sách chữa tật nói lắp Version 1.0 beta
Bình Trọng Án
 

Recently uploaded (20)

Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data ResilienceFloods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
Edge AI and Vision Alliance
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training RoadblocksDown the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
Oracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI FoundationsOracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI Foundations
VICTOR MAESTRE RAMIREZ
 
High Availability On-Premises FME Flow.pdf
High Availability On-Premises FME Flow.pdfHigh Availability On-Premises FME Flow.pdf
High Availability On-Premises FME Flow.pdf
Safe Software
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptxFIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptxFIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdfENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
Muhammad Rizwan Akram
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME FlowProviding an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
Analysis of the changes in the attitude of the news comments caused by knowin...
Analysis of the changes in the attitude of the news comments caused by knowin...Analysis of the changes in the attitude of the news comments caused by knowin...
Analysis of the changes in the attitude of the news comments caused by knowin...
Matsushita Laboratory
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free DownloadViral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdfCrypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data ResilienceFloods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
Edge AI and Vision Alliance
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training RoadblocksDown the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
Oracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI FoundationsOracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI Foundations
VICTOR MAESTRE RAMIREZ
 
High Availability On-Premises FME Flow.pdf
High Availability On-Premises FME Flow.pdfHigh Availability On-Premises FME Flow.pdf
High Availability On-Premises FME Flow.pdf
Safe Software
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptxFIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptxFIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdfENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
Muhammad Rizwan Akram
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME FlowProviding an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
Analysis of the changes in the attitude of the news comments caused by knowin...
Analysis of the changes in the attitude of the news comments caused by knowin...Analysis of the changes in the attitude of the news comments caused by knowin...
Analysis of the changes in the attitude of the news comments caused by knowin...
Matsushita Laboratory
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free DownloadViral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdfCrypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 

Displaying XML Documents Using CSS and XSL

  • 1. Displaying XML Documents Using CSS and XSL Chapter 3
  • 2. Review-1 A well-formed document is one that conforms to the basic rules of XML. A valid document is well formed and is also validated against a DTD. The DTD specifies the grammatical structure of an XML document, thereby allowing XML parsers to understand and interpret the document’s contents. The use of the SYSTEM keyword indicates to the parser that this is an external declaration, and that the set of rules for this XML document can be found in a specified file. EMPTY element-content type specifies that the element has no child elements or character data.
  • 3. Review-2 #CDATA means that the element contains character data that is not to be parsed by a parser. #PCDATA means that the element contains data that is to be parsed by a parser. Specifying a default value for an attribute in the DTD ensures that the attribute will get a value, even if the author of the XML document does not include it. Specifying the value of an attribute as ‘Implied’ means that the particular attribute is not mandatory and can be specified in the XML document. Specifying the value of an attribute as ‘Required’ means that the particular attribute is mandatory (that is, its value must be provided in the XML document).
  • 4. Review-3 ‘ ID’ is the identifier type, and should be unique. This attribute value is used to search for a particular instance of an element. Each element can only have one attribute of type ID. A DTD can be either External or Internal. Entities allow us to create an alias to some large piece of text, so that, in the document, the same piece of text can be referred to, simply by referring to the alias. Namespaces allow us to combine documents from different sources, and be able to identify which elements or attributes come from which source.
  • 5. Objectives Display an XML document in a browser Identify the style rules of CSS Discuss different patterns and templates of XSL Apply different styles to XML elements using CSS and XSL Transform XML documents into HTML documents using XSLT Identify the differences between CSS and XSL
  • 6. Style Sheets - 1 An XML document can be displayed in different formats in different display devices such as computer, printer, and the like. Document to be displayed
  • 7. Style Sheets - 2 A Style sheet is a set of instructions to display the documents: It separates presentation layer from the content data of the document. A single XML document can have multiple style sheets Style sheets Data Presentation Layer
  • 8. Style Sheets - 3 A few style sheets available in the market include: CSS- Cascading Style Sheets XSL-eXtensible Style sheet Language DSSL-Document Style Semantics and Specification Language
  • 9. Uses of CSS and XSL Cascading style sheet is used to manipulate Visibility of an element Positioning and sizing of elements Colors and Background Font and Text Spacing XSL is used for formatting and converting documents written in one XML DTD into another DTD.
  • 10. XML and Style Sheets XML documents are plain text files. The style sheets are used to format and view the XML document. Two commonly used style sheets with XML are: CSS - an extension of HTML XSL - an XML specific styling language
  • 11. Working of XML XML File CSS (XML + CSS) aware Browser Formatted Document
  • 12. Displaying an XML Document Using CSS -1 XML document <?xml version='1.0'?> <?xml-stylesheet type=&quot;text/css&quot; href=&quot;hello.css&quot;?> <xsampdoc> <greeting>Hello, <extension>there!</extension> </greeting> <answer> <ans>Good <extension>morning!</extension> </ans> <question> How are you? </question> </answer> </xsampdoc>
  • 13. Displaying an XML Document Using CSS -1 Xsampdoc { margin-top:.7in; margin-bottom: .7in; margin-left:1.5in; margin-right:1in; color: navy; background-color:white; display: block } greeting { display:block; font-family: Arial, Helvetica, sans- serif;font-size: 32pt; width: 30em; color: red } question { display:block; font-size: x-large; color: black; } answer.ans { display : block; font-size: 20pt; color: blue } The CSS document for the XML document
  • 14. Displaying an XML Document Using CSS -2 OUTPUT
  • 15. CSS Style Rules The Syntax for style rules in a Cascading Style Sheet is: Selector{declaration} The selector identifies the tag to which the style applies. The declaration provides the style rules applied to the selector. This is referred as ‘Simple Selector’. Example: greeting {display:block;font-family: Arial, Helvetica,sans-serif; font-size: 32pt; width: 30em; color: red }
  • 16. Multiple Selector Used to apply the same style rule for different elements Syntax: selector,selector…….{declaration} Example greeting,question {font-family: sans-serif; font-size: 32pt; } Style Rule Selector 1 Selector 2 The same Style Rule is being used by Selector1 and Selector2
  • 17. Contextual Selectors -1 It helps us to differentiate between the different occurrence of a tag. MADE IN U.S.A tag Occurrence 1 Occurrence 2 Occurrence 1 tag([declaration]} Occurrence 2 tag([declaration]} Conceptual Selector
  • 18. Contextual Selectors -2 Example: <xsampdoc> <greeting>Hello! <extension>there</extension></greeting> <answer> <ans>Fine<extension>here</extension></ans> <ans>Thank you.</ans> </answer> </xsampdoc> Contextual Selectors to differentiate between the different occurrences of <extension> greeting extension{[declarations]} answer ans extension{[declaration]}
  • 19. Characters used in CSS Separates multiple selectors in a style rule Comma , Identifies selector context Period . Separates multiple property/value combinations Semicolon ; Separates property and its value Colon : Function Name Character
  • 20. Linking the CSS to XML The Cascading style sheet has to be referenced in the XML document. We use a processing instruction to do so. Syntax: <?xml-stylesheet type=“text/css” href=“url”?> Example <?xml-stylesheettype=&quot;text/css“ href=&quot;hello.css&quot;?>
  • 21. Properties and Values A value of the CSS styling property may be a string, a number with a unit, an integer, or a color value. Values can be absolute or relative, inheritable or non-inheritable. Example Absolute value P{margin-left:3cm;} A margin of 3 centimeter is created irrespective of the margin size. Example Relative value P{margin-left:10%} A margin of 10% of the width of the page is created.
  • 22. Color Values XML supports the following color values:   Gray White Red Short form #888 #FFF #F00 Decimal Integer rgb(136,136,136) rgb(255,255,255) rgb(255,0,0) Percentage rgb(55%,55%,55%) rgb(100%,100%,100%) rgb(100%,0,0)
  • 23. Formatting the Text - 1 The CSS properties allow to specify the font in which an element will be displayed, its size and color. <absolute-size> and <relative-size> keywords are used with font properties <absolute-size> xx-small x-small small medium <relative-size> large smaller
  • 24. Formatting the Text - 2 The different font properties that can be set are: font-family font-size font-style font-weight font-variant Font
  • 25. Boxes -1 Blocks of text can be contained in a box. The following three properties apply to the boxes: Margins Border Padding Padding is the distance between the contents of the adjacent box. Margin is the distance between the border and the outer edge of the adjacent box, or between the border and its containing box.
  • 27. Margins, Border and Padding The padding property is used to specify the distance or space between the border and its contents. Boxes margin-top margin-bottom margin-left margin-right margin Margins Border border-top border-bottom border-left border-right border padding-bottom padding-top padding-right padding-left padding Padding
  • 28. Controlling Layout The CSS layout properties can control the box on the screen. The boxes can be overlapped using the z-index property. A paragraph that is two inches by one inch and with a scroll bar is displayed
  • 29. XSL It is a style sheet application created specifically for XML. Features of XSL include: It provides a transformation language (XSLT). XSL can be used as a formatting language. XSL can be used to sort and filter. XSL can be used for pattern matching to find records.
  • 30. XSL - 2 XML Document XSL HTML document displayed in the Web HTML CSS
  • 31. Example for XSL The XSL style sheet code <html> <head> <title>Icons In Cricket</title> </head> <body> <h2>Icons In Cricket</h2> <table border=&quot;2&quot; cellpadding=&quot;3&quot;> <tr> <td>Player</td> <td>No. Of Catches</td> <td>No. Of 100's</td> <td>No. Of 50's</td> </tr> <xsl:for-each select=&quot;cricket/player&quot; order-by =&quot;-catches&quot;> <tr> <td><xsl:value-of select=&quot;name&quot;/></td> <td><xsl:value-of select=&quot;no_50&quot;/></td> <td><xsl:value-of select=&quot;no_100&quot;/></td> <td><xsl:value-of select=&quot;catches&quot;/></td> </tr> </xsl:for-each> </table> </body> </html>
  • 32. Patterns The patterns supported in XSL are: Sorting Operators Filtering Letters after sorting
  • 33. Sorting The default sorting is ascending order. The ‘-’ sign is used to sort in descending order. The chart is organized in the descending order of catches
  • 34. Operators XSL supports the se operators: / ./ // .// * @ = /*/name */* @* //name
  • 35. Filtering and Logical Operators Filter operations can contain expression such as Boolean expression, AND, OR, and NOT expressions The different logical operators that can be used are: Operator Description AND Logical and OR Logical or NOT Negation = Equal != Not equal > Greater than < Less than >= Greater than or equal to <= Less than or equal
  • 36. Templates Templates are the instructions in an XSL style sheet, which control the conversion of element and its content. It is represented by <xsl:template>…</xsl:template> It is applied with the <xsl:apply-templates/> element The template has two parts: The matching part The processing part Matching part Processing part
  • 37. Types of Matching Matching Matching by name Matching by ancestry Matching several names Matching the root Wildcard matches Matching by ID Matching by attributes
  • 38. Handling Expressions XSL supports five types of Expressions. These are: Node Sets Booleans Strings Numbers Result Tree Fragments
  • 39. Switching Styles Data Islands 1 XML document Data Islands 2 Data Islands 3 XML document with XSL style sheet 1 XML document with XSL style sheet 2 XML document with XSL style sheet 3
  • 40. xsl:import and xsl:include Style sheets created by other developers can be imported using the xsl:import The syntax for importing style sheets is: <xsl:import href= ‘another stylesheet.xsl’/> <xsl:import href= ‘another stylesheet1.xsl’/> All the different style sheets imported are arranged in an import tree. A new node is created in the import tree when a style sheet is imported
  • 41. Difference Between XSL and CSS It transforms XML into structures such as lists or tables It does not change the structure of the document XSLT lets us to map a certain pattern in the source document CSS determines the visual appearance of a page XSL provides means of transforming of XML documents CSS work by assigning a set of display properties to an HTML element
  • 42. Summary-1 XML is portable. An XML document can be sent from one system to another, and even from application to application, without modifying the content. A style sheet is a set of instructions to display documents. Style sheets can be written in several languages. Two of these are:
  • 43. Cascading Style Sheets (CSS), an extension of HTML eXtensible Stylesheet Language (XSL), an XML specific styling language The selector identifies the tag to which the style applies, and the declaration provides the style rules applied, to the selector .
  • 44. Summary-2 The list of selectors includes Simple selectors, Contextual selectors and Multiple selectors. Contextual Selectors help to differentiate between the different occurrences of a tag. The Multiple Selector is used to assign the same style rule to different elements. One declaration can be applied to several selectors. A block of text can be contained in a box, and this box can then be placed on the browser. The three properties that apply to the boxes are: margins, borders and padding
  • 45. The CSS layout properties can control the layout of the box on the screen. Boxes can be overlapped using the z-index property. This specifies the height and width for a box. XSL is a style sheet language created specifically for XML. It is used to convert XML documents into HTML. Cascading style sheets are applied to the resulting HTML documents for display on the web.
  • 46. Summary-3 The instructions that control how an element and its content should be converted in an XSL style sheet, are called templates. XSL provides support for the following patterns: Sorting Operators Filtering A typical template element looks like this: <xsl:template match = &quot;myElement&quot;> Types of Matching Matching by attribute Matching by ID Matching by wildcard Matching by root Matching by name

Editor's Notes

  • #31: HTML can be displayed without css add to FG