Lecture 11 XSL Transformations (part 1: Introduction)

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.
CG0119 Web Database Systems Parsing XML: using SimpleXML & XSLT.
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.
XSL XSLT and XPath 11-Apr-17.
+ XSL eXtensible Stylesheet Language. + 2 XML Lecture Adapted from the work of Prof Mark Baker ACET, University of Reading.
XML and XSL Transforming your XML documents with eXtensible Stylesheet Language Transformations [Optional Lecture]
1 CP3024 Lecture 9 XML revisited, XSL, XSLT, XPath, XSL Formatting Objects.
XSLT Stylesheets Some more advanced examples (adapted from the Edinburgh LT site)
Lecture 10. Back to the table example We can now return to considering in detail the first XSLT style-sheet we saw –The one which, when applied to the.
Rendering XML documents with XSL The most powerful approaches to rendering XML documents involve using XSL (eXtensible Stylesheet Language) XSL enables.
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.
XSL Transformations Lecture 8, 07/08/02. Templates The whole element is a template The match pattern determines where this template applies Result element(s)
1 Copyright (c) [2000]. Roger L. Costello. All Rights Reserved. Using XSLT and XPath to Transform XML Documents Roger L. Costello XML Technologies.
XML Language Family Detailed Examples Most information contained in these slide comes from: These slides are intended.
XML Technologies and Applications Rajshekhar Sunderraman Department of Computer Science Georgia State University Atlanta, GA 30302
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)
MC 365 – Software Engineering Presented by: John Ristuccia Shawn Posts Ndi Sampson XSLT Introduction BCi.
SD2520 Databases using XML and JQuery
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.
XML – Extensible Markup Language XML eXtensible – add to language. Markup – delimit info using tags. Language – a way to express info.
XML for E-commerce III Helena Ahonen-Myka. In this part... n Transforming XML n Traversing XML n Web publishing frameworks.
IS432 Semi-Structured Data Lecture 5: XSLT Dr. Gamal Al-Shorbagy.
XSLT for Data Manipulation By: April Fleming. What We Will Cover The What, Why, When, and How of XSLT What tools you will need to get started A sample.
XSL XML Stylesheet Langauage. XPath Notation for addressing elements in an XML document /xyz - selects the root element /xyz/abc - selects all elements.
XP New Perspectives on XML Tutorial 6 1 TUTORIAL 6 XSLT Tutorial – Carey ISBN
CIS 451: XSL Dr. Ralph Westfall February, Problems With XML no formatting capabilities contra formatting tags like, etc. in HTML CSS can be used.
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
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 6 XSLT (Based on Møller and Schwartzbach,
Transforming XML Part II XML Document Transformation with XSLT John Arnett, MSc Standards Modeller Information and Statistics Division NHSScotland Tel:
Lecture 14 Extensible Stylesheet Language Transformations : XSLT.
1 XSLT An Introduction. 2 XSLT XSLT (extensible Stylesheet Language:Transformations) is a language primarily designed for transforming the structure of.
ECA 228 Internet/Intranet Design I XSLT Example. ECA 228 Internet/Intranet Design I 2 CSS Limitations cannot modify content cannot insert additional text.
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
Extensible Stylesheet Language Chao-Hsien Chu, Ph.D. School of Information Sciences and Technology The Pennsylvania State University XSL-FO XSLT.
XML Part 2 Josh Steele CS 6704, Spring XML Part 2 XSL/XSLT –Structure Revisited –Definition –Example –Components XML’s Linking Languages XML’s Uses.
The Information School at the University of Washington INFO 440: Information System Design Fall 2003 * Bob Boiko * MSIM Associate Chair XML Transforms.
XSLT Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Transforming Documents „a how-to of transforming xml documents“ Lecture on Walter Kriha.
CIS 375—Web App Dev II XSL. 2 XSL Introduction XSL stands for _____________________________. XSL is the language used for manipulating and displaying.
 2002 Prentice Hall, Inc. All rights reserved. 1 Chapter 12 – XSL: Extensible Stylesheet Language Transformations (XSLT) Outline 12.1Introduction 12.2Setup.
Lecture 15 XSL Transformations (part V) Acknowledgment:
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Applying eXtensible Style Sheets (XSL) Ellen Pearlman Eileen Mullin Programming.
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.
XP New Perspectives on XML, 2 nd Edition Tutorial 8 1 TUTORIAL 8 CREATING ELEMENT GROUPS.
1 Copyright (c) [2000]. Roger L. Costello. All Rights Reserved. Using XSLT and XPath to Transform XML Documents Roger L. Costello XML Technologies.
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.
University of Nottingham School of Computer Science & Information Technology Introduction to XML 2. XSLT Tim Brailsford.
XSLT: How Do We Use It? Nancy Hallberg Nikki Massaro Kauffman.
XSLT I Robin Burke ECT 360. Outline History / Terminology XSLT processing XSLT syntax XPath XSLT basics Lab.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
1 Extensible Stylesheet Language (XSL) Extensible Stylesheet Language (XSL)
XML Schema – XSLT Week 8 Web site:
Some Notes on XSLT Eugenia Fernandez IUPUI. Transforming XML with XSLT XSLT processor converts XML document into a node tree Uses XSLT stylesheet for.
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.
Rendering XML Documents ©NIITeXtensible Markup Language/Lesson 5/Slide 1 of 46 Objectives In this session, you will learn to: * Define rendering * Identify.
CH 15 XSL Transformations 1. Objective What is XSL? Overview of XSL transformations Understanding XSL templates Computing the value of a node with xsl:value-of.
Unit 4 Representing Web Data: XML
XSLT 1.0.
ACG 4401 XSLT Extensible Stylesheet Language for Transformations
More Sample XML By Sadia Anjum.
CS 431 – February 28, 2005 Carl Lagoze – Cornell University
Unit 6 - XML Transformations
Presentation transcript:

Lecture 11 XSL Transformations (part 1: Introduction)

What is XSL? Stylesheets are typically used to specify how something should be displayed/rendered. Stylesheets are typically used to specify how something should be displayed/rendered. They lead to separation of document's content from presentational information. They lead to separation of document's content from presentational information. The Extensible Stylesheet Language (XSL) includes two independent parts: a transformation language (XSLT) and formatting objects language (XSL:FO). The Extensible Stylesheet Language (XSL) includes two independent parts: a transformation language (XSLT) and formatting objects language (XSL:FO).

What is XSL? (contd.) Both XSLT and XSL:FO are XML applications. Both XSLT and XSL:FO are XML applications. XSLT provides elements that define rules for how one XML document is transformed into another text document. XSLT provides elements that define rules for how one XML document is transformed into another text document. XSL:FO XSL:FO Page oriented formatting syntax;Page oriented formatting syntax; A formatting object is an area with certain formatting properties;A formatting object is an area with certain formatting properties; Mostly used for PDF generation.Mostly used for PDF generation.

.xml XSLT Processor.xsl XSLT Stylesheet XSLT Processor.xml XML Document

.xml XSLT Processor.xsl XSLT Stylesheet XSLT Processor XML Document.html HTML Document

.xml XSLT Processor.xsl XSLT Stylesheet XSLT Processor XML Document.tex.rtf Text File (eventually containing formatting information)

XSLT Stylesheet (1) XML document Pictures from My Holiday Seaside town Sea port

XSLT Stylesheet (2) XML Document's Tree Text Node Element Node PictureSet Element Node title Element Node picture Element Node picture Element Node source Element Node source Element Node description Element Node thumbnail Attribute Node location: town.jpg Attribute Node location: port_t.jpg Attribute Node location: port.jpg Attribute Node width : 750 Attribute Node height : 544 Attribute Node height : 509 Attribute Node width : 878 Text Node Element Node description Root

XSLT Stylesheet (3) XSLT processor models an XML document as a tree that contains seven kind of nodes: the root, element, text, attribute, namespace, processing instruction, comment. XSLT processor models an XML document as a tree that contains seven kind of nodes: the root, element, text, attribute, namespace, processing instruction, comment. XSLT operates by transforming one XML tree into another XML tree by employing operators for selecting nodes from the tree, reordering the nodes, and outputting nodes. XSLT operates by transforming one XML tree into another XML tree by employing operators for selecting nodes from the tree, reordering the nodes, and outputting nodes. Original XML document An XML/HTML document XSL Transformation

XSLT Stylesheet (4) The Stylesheet picturegallery.xsl <xsl:stylesheet version="1.0" xmlns:xsl=" I found PictureSet I found description template rule

Template Rules The XPath expression specifies a pattern to be matched by a node in the document's tree. The XPath expression specifies a pattern to be matched by a node in the document's tree. The substitution part specifies what should be inserted instead of the matched pattern: The substitution part specifies what should be inserted instead of the matched pattern: XSL elements, markup and textXSL elements, markup and text Substitution part General structure of an XSLT rule:

Template Rules (contd.) An XSLT processor transforms an XML document starting from the root of the document tree. An XSLT processor transforms an XML document starting from the root of the document tree. At each turn, a node from the document tree is compared to the template rules. At each turn, a node from the document tree is compared to the template rules. When the XSLT processor finds a template rule such that the current node matches its pattern then the XSLT processor outputs the template rule’s substitution part to the result document. When the XSLT processor finds a template rule such that the current node matches its pattern then the XSLT processor outputs the template rule’s substitution part to the result document. If the substitution part contains then at that point the child (element and text) nodes of the current node are processed one by one. This is a recursive process. If the substitution part contains then at that point the child (element and text) nodes of the current node are processed one by one. This is a recursive process.

Another Version of picturegallery.xsl <xsl:stylesheet version="1.0" xmlns:xsl=" template rule

Default Template Rules Matches the document tree’s root node ( / ) and any element node ( * ) and applies template to their child nodes. Matches the document tree’s root node ( / ) and any element node ( * ) and applies template to their child nodes. Note that the document tree's root node is NOT the node that corresponds to the root element of the XML document. Note that the document tree's root node is NOT the node that corresponds to the root element of the XML document. Attribute and Namespace nodes are NOT considered child nodes. Only element, comment, text and processing instruction nodes can be child nodes. Attribute and Namespace nodes are NOT considered child nodes. Only element, comment, text and processing instruction nodes can be child nodes. Default Rule 1

Default Template Rules (contd.) matches any text node ( text() ) and any attribute node ) and outputs their values. matches any text node ( text() ) and any attribute node ) and outputs their values. Default Rule 2 matches any processing instruction and comment nodes and does not output anything to the result document (i.e., does not perform any action). matches any processing instruction and comment nodes and does not output anything to the result document (i.e., does not perform any action). Default Rule 3

Result of Applying the second version of picturegallery.xsl to the example XML Document Pictures from My Holiday Seaside town Busy street Sea port Question: What will be the result of applying the very simple stylesheet <xsl:stylesheet version="1.0" xmlns:xsl=" to the same XML document? Why?