IS432 Semi-Structured Data Lecture 5: XSLT Dr. Gamal Al-Shorbagy.

Slides:



Advertisements
Similar presentations
XML-XSL Introduction SHIJU RAJAN SHIJU RAJAN Outline Brief Overview Brief Overview What is XML? What is XML? Well Formed XML Well Formed XML Tag Name.
Advertisements

XML III. Learning Objectives Formatting XML Documents: Overview Using Cascading Style Sheets to format XML documents Using XSL to format XML documents.
Transforming XML XMLNamespaces, XSLT. XML Namespaces Sometimes it is necessary to mix XML elements –Different types of content –Use of markup to convey.
CG0119 Web Database Systems Parsing XML: using SimpleXML & XSLT.
Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site.
Technology Reviews :XSL Park, Ho-gun. What is XSL Extensible Style sheet LanguageExtensible Style sheet Language An XML-based language used to.
XSL eXtensible Stylesheet Language. What is XSL? XSL is a language that allows one to describe a browser how to process an XML file. XSL can convert an.
1 XSLT – eXtensible Stylesheet Language Transformations Modified Slides from Dr. Sagiv.
SPECIAL TOPIC XML. Introducing XML XML (eXtensible Markup Language) ◦A language used to create structured documents XML vs HTML ◦XML is designed to transport.
XSLT (eXtensible Stylesheet Language Transformation) 1.
XML 6.2 XSL / XSLT 6. What is XSL? XSL stands for eXtensible Stylesheet Language CSS was designed for styling HTML pages, and can be used to style XML.
XSL XSLT and XPath 11-Apr-17.
XML: Managing Data Exchange Stylesheets. Lesson Contents CSS The basic XSL file XSL transforms Templates Sort Numbering Parameters and Variables Datatypes.
1 CP3024 Lecture 9 XML revisited, XSL, XSLT, XPath, XSL Formatting Objects.
XSLT & XPATH. From Friday Everything in XML is machine readable Attributes describe elements, so does an element’s place in the tree (context) XML must.
XSL Concepts Lecture 7. XML Display Options What can XSL Transformations do? generation of constant text suppression of content moving text (e.g., exchanging.
XSL Unit 6 November 2. XSL –eXtensible Stylesheet Language –Basically a stylesheet for XML documents XSL has three parts: –XSLT –XPath –XSL-FO.
XML Technologies and Applications Rajshekhar Sunderraman Department of Computer Science Georgia State University Atlanta, GA 30302
Introduction to XML: Yong Choi CSU Bakersfield.
XSLT transformations Or how to get your XML to become HMTL.
September 15, 2003Houssam Haitof1 XSL Transformation Houssam Haitof.
17 Apr 2002 XML Stylesheets Andy Clark. What Is It? Extensible Stylesheet Language (XSL) Language for document transformation – Transformation (XSLT)
Manohar – Why XML is Required Problem: We want to save the data and retrieve it further or to transfer over the network. This.
Introduce of XML Xiaoling Song CS157A. What is XML? XML stands for EXtensible Markup Language XML stands for EXtensible Markup Language XML is a markup.
XSLT XSLT: eXtensible Stylesheet Language for Transformations - a language for transforming XML documents into any text- based format (e.g. HTML, plain.
ECA 228 Internet/Intranet Design I Intro to XSL. ECA 228 Internet/Intranet Design I XSL basics W3C standards for stylesheets – CSS – XSL: Extensible Markup.
XSLT 1. C ONTENTS XSLT and uses XSLT example Simple XML How XSLT works? Template-match Value-of For-each and sort If Choose-when Apply-templates Where.
Introduction technology XSL. 04/11/2005 Script of the presentation Introduction the XSL The XSL standard Tools for edition of codes XSL Necessary resources.
XP New Perspectives on XML Tutorial 6 1 TUTORIAL 6 XSLT Tutorial – Carey ISBN
XSLT transformations Or how to get your XML to become HMTL.
CIS 451: XSL Dr. Ralph Westfall February, Problems With XML no formatting capabilities contra formatting tags like, etc. in HTML CSS can be used.
CSC 330 E-Commerce Teacher Ahmed Mumtaz Mustehsan Ahmed Mumtaz Mustehsan GM-IT CIIT Islamabad GM-IT CIIT Islamabad CIIT Virtual Campus, CIIT COMSATS Institute.
XP 1 CREATING AN XML DOCUMENT. XP 2 INTRODUCING XML XML stands for Extensible Markup Language. A markup language specifies the structure and content of.
WORKING WITH XSLT AND XPATH
Session II Chapter 2 – Chapter 2 – XSLhttp://
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 6 XSLT (Based on Møller and Schwartzbach,
XHTML,XML M.Abdullah Mrian. What is the XHTML Why XHTML ?
XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML.
XML TUTORIAL Portions from w3 schools By Dr. John Abraham.
ECA 228 Internet/Intranet Design I XSLT Example. ECA 228 Internet/Intranet Design I 2 CSS Limitations cannot modify content cannot insert additional text.
Li Tak Sing COMPS311F. XPath XPath is a simple language that allows you to write expressions to refer to different parts of an XML document. We will learn.
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
XSLT Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
IST 221 Internet Concepts and Applications Introduction to XML II CSS and XSLT Style Sheets.
1 Displaying XML Document Web and Database Management System.
CIS 375—Web App Dev II XSL. 2 XSL Introduction XSL stands for _____________________________. XSL is the language used for manipulating and displaying.
Presentation Topic: XML and ASP Presented by Yanzhi Zhang.
Lecture 11 XSL Transformations (part 1: Introduction)
XHTML and CSS Session 1 Intro, (X)HTML, CSS, W3C, browsers, webpage, structure, tags, attributes, elements, web development process, basic XHTML elements.
Windows Presentation Foundation (WPF) Chapter 16 Dr. Abraham.
Waqas Anwar Next SlidePrevious Slide. Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language.
1 Introduction  Extensible Markup Language (XML) –Uses tags to describe the structure of a document –Simplifies the process of sharing information –Extensible.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Applying eXtensible Style Sheets (XSL) Ellen Pearlman Eileen Mullin Programming.
ITB Web programming for E- Commerce 1 ITB6227 Programming for E-COMMERCE Lecture Presentation of XML Documents.
1 Overview of XSL. 2 Outline We will use Roger Costello’s tutorial The purpose of this presentation is  To give a quick overview of XSL  To describe.
1 Tutorial 11 Creating an XML Document Developing a Document for a Cooking Web Site.
Cascading Style Sheets CSS. Source W3Schools
Dr. Chunbo Chu Week 3. XML Not a replacement for HTML. XML and HTML were designed with different goals: XML was designed to transport and store data,
XSLT. XSLT stands for Extensible Stylesheet Language Transformations XSLT is used to transform XML documents into other kinds of documents. XSLT can produce.
Unit 3 — Advanced Internet Technologies Lesson 11 — Introduction to XSL.
 XSL – Extensible Style Sheet Language  XSLT – XSL Transformations › Used to transform XML documents to other formats,like HTML or other XML documents.
XSLT: How Do We Use It? Nancy Hallberg Nikki Massaro Kauffman.
XML Introduction to XML Extensible Markup Language.
1 XSL Transformations (XSLT). 2 XSLT XSLT is a language for transforming XML documents into XHTML documents or to other XML documents. XSLT uses XPath.
XML Notes taken from w3schools. What is XML? XML stands for EXtensible Markup Language. XML was designed to store and transport data. XML was designed.
Rendering XML Documents ©NIITeXtensible Markup Language/Lesson 5/Slide 1 of 46 Objectives In this session, you will learn to: * Define rendering * Identify.
1 Extensible Stylesheet Language (XSL) Extensible Stylesheet Language (XSL)
Session IV Chapter 14 – Chapter 14 – XSLThttp://
XSLT: The XML transformation language
Unit 6 - XML Transformations
Presentation transcript:

IS432 Semi-Structured Data Lecture 5: XSLT Dr. Gamal Al-Shorbagy

XML Stylesheet Langugae  Extensible Stylesheet Language (XSL)  Language for document transformation  Transformation  Converting XML to another form  Formatting objects  Layout of XML document  Search document contents  Navigating XML document tree nodes

XML Stylesheet Language XSL-FO XSLT XPath Navigating XML Document Formatting XML Document Transforming XML Document

CSS (Cascading Style Sheets) CSS = Style Sheets for HTML HTML uses predefined tags, and the meaning of each tag is well understood. The tag in HTML defines a table - and a browser knows how to display it. Adding styles to HTML elements are simple. Telling a browser to display an element in a special font or color, is easy with CSS.

XML Style Sheets XSL = Style Sheets for XML XML does not use predefined tags (we can use any tag-names we like), and therefore the meaning of each tag is not well understood. A tag could mean an HTML table, a piece of furniture, or something else - and a browser does not know how to display it. XSL describes how the XML document should be displayed!

XSL In Parts XSL - More Than a Style Sheet Language XSL consists of three parts: – XSLT - a language for transforming XML documents – XPath - a language for navigating in XML documents – XSL-FO - a language for formatting XML documents

What is XSLT? XSLT stands for XSL Transformations XSLT is the most important part of XSL – XSLT transforms an XML document into another XML document – XSLT uses XPath to navigate in XML documents – XSLT is a W3C Recommendation

XSLT = XSL Transformations XSLT is the most important part of XSL. XSLT is used to transform an XML document into another XML document – Or another type of document that is recognized by a browser, like HTML and XHTML. – Normally XSLT does this by transforming each XML element into an (X)HTML element.

XSLT = XSL Transformations With XSLT you can add/remove elements and attributes to or from the output file. – You can also rearrange and sort elements, – Perform tests and make decisions about which elements to hide and display, and a lot more. A common way to describe the transformation process is to say that XSLT transforms an XML source-tree into an XML result-tree.

Browsers Support for XSLT Mozilla Firefox – Firefox supports XML, XSLT, and XPath from version 3. Internet Explorer – Internet Explorer supports XML, XSLT, and XPath from version 6. – Internet Explorer 5 is NOT compatible with the official W3C XSL Recommendation. Google Chrome – Chrome supports XML, XSLT, and XPath from version 1. Opera – Opera supports XML, XSLT, and XPath from version 9. Opera 8 supports only XML + CSS. Apple Safari – Safari supports XML and XSLT from version 3.

Example Study How to transform XML into XHTML using XSLT.

Transform XML into XHTML 1.Style Sheet Declaration 2.Start with a Raw XML Document 3.Create an XSL Style Sheet 4.Link the XSL Style Sheet to the XML Document

Style Sheet Declaration W3C XSLT Recommendation The official W3C XSLT namespaceMust attribute, value pair top

Raw XML Document Empire Burlesque Bob Dylan USA Columbia

An XSL Style Sheet My CD Collection Title Artist XML document declaration This document is a Stylesheet

Linking XML with Stylesheet Empire Burlesque Bob Dylan USA Columbia

XSL Templates An XSL style sheet consists of one or more set of rules that are called templates. A template contains rules to apply when a specified node is matched.

XSL Templates The Element – Used to build templates The match attribute – Associates a template with an XML element. – Also used to define a template for the entire XML document. – The value of the match attribute is an XPath expression (i.e. match="/" defines the whole document).

XSL Templates The element defines a template. The match="/" attribute associates the template with the root of the XML source document. The content inside the element defines some HTML to write to the output.

Xpath Expressions Path ExpressionResult bookstore /bookstore bookstore/book //book bookstore//book Harry Potter XML 4 Dummies The Han River

Example XSL Style Sheet My CD Collection Title Artist.. XML document declaration This document is a Stylesheet End of template End of stylesheet associates the template with the root of the XML source document HTML to write to the output

Output

Stylesheet Nuts&Bolts The Element – Extract the value of an XML element and add it to the output stream of the transformation – The select attribute contains an XPath expression

Example XSL Style Sheet My CD Collection Title Artist XML document declaration This document is a Stylesheet End of template End of stylesheet Selecting a specific element value HTML to write to the output

Output

Stylesheet Nuts&Bolts The Element – select every XML element of a specified element list – Note: An XPath expression in value of select.

Example XSL Style Sheet My CD Collection Title Artist XML document declaration This document is a Stylesheet End of template End of stylesheet Selecting each element in a list of elements HTML to write to the output

Output

Filtering the Output using Predicates Path ExpressionResult /bookstore/book[1] /bookstore/book[last()] /bookstore/book[last()-1] /bookstore/book[position()<3] /bookstore/book[price>35.00] /bookstore/book[price>35.00]/title Harry Potter XML 4 Dummies The Han River

Example XSL Style Sheet My CD Collection Title Artist XML document declaration This document is a Stylesheet End of template End of stylesheet Filtering output HTML to write to the output

Output ?

Stylesheet Nuts&Bolts The Element – Sort the out put wrt select value – Value of select is ?.

Example XSL Style Sheet My CD Collection Title Artist XML document declaration This document is a Stylesheet End of template End of stylesheet Sorting output HTML to write to the output

Output

Stylesheet Nuts&Bolts Placement: The element always inside the element Attribute: The Value of test is an XPath expression.

Example XSL Style Sheet My CD Collection Title Artist Price 10”> predicate HTML to write to the output

Output

Stylesheet Nuts&Bolts The,, and – a multiple conditional test against the XML file, add... some output some output....

Stylesheet Nuts&Bolts

Output

My CD Collection Title: Artist:

Output

References W3 Schools – Online XSLT Test Tool –

Thanks