September 15, 2003Houssam Haitof1 XSL Transformation Houssam Haitof.

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.
UFCE8V-20-3 Information Systems Development 3 (SHAPE HK) Lecture 12 Extensible Stylesheet Language Transformations : XSLT.
 2001 Prentice Hall, Inc. All rights reserved. 1.
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.
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.
1 CP3024 Lecture 9 XML revisited, XSL, XSLT, XPath, XSL Formatting Objects.
XSLT Stylesheets Some more advanced examples (adapted from the Edinburgh LT site)
CSE 190: Internet E-Commerce Lecture 17: XML, XSL.
Rendering XML documents with XSL The most powerful approaches to rendering XML documents involve using XSL (eXtensible Stylesheet Language) XSL enables.
XSL Transformations (XSLT) Meghasyam Bokam April’1 st, 2002.
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 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
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.
Manohar – Why XML is Required Problem: We want to save the data and retrieve it further or to transfer over the network. This.
SD2520 Databases using XML and JQuery
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.
Sheet 1XML Technology in E-Commerce 2001Lecture 6 XML Technology in E-Commerce Lecture 6 XPointer, XSLT.
CSE3201/CSE4500 XPath. 2 XPath A locator for elements or attributes in an XML document. XPath expression gives direction.
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.
CSE3201/CSE4500 Information Retrieval Systems
XP New Perspectives on XML Tutorial 6 1 TUTORIAL 6 XSLT Tutorial – Carey ISBN
XSLT and XPath, by Dr. Khalil1 XSL, XSLT and XPath Dr. Awad Khalil Computer Science Department AUC.
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 © Netskills Quality Internet Training, University of Newcastle Introducing XML © Netskills, Quality Internet Training University.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 6 XSLT (Based on Møller and Schwartzbach,
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.
XSLT Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Transforming Documents „a how-to of transforming xml documents“ Lecture on Walter Kriha.
Lecture 11 XSL Transformations (part 1: Introduction)
1 Introduction  Extensible Markup Language (XML) –Uses tags to describe the structure of a document –Simplifies the process of sharing information –Extensible.
 2002 Prentice Hall, Inc. All rights reserved. 1 Chapter 12 – XSL: Extensible Stylesheet Language Transformations (XSLT) Outline 12.1Introduction 12.2Setup.
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.
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.
XPath. XPath, the XML Path Language, is a query language for selecting nodes from an XML document. The XPath language is based on a tree representation.
More XML XPATH, XSLT CS 431 – February 23, 2005 Carl Lagoze – Cornell University.
 XSL – Extensible Style Sheet Language  XSLT – XSL Transformations › Used to transform XML documents to other formats,like HTML or other XML documents.
XP New Perspectives on XML, 2 nd Edition Tutorial 7 1 TUTORIAL 7 CREATING A COMPUTATIONAL STYLESHEET.
University of Nottingham School of Computer Science & Information Technology Introduction to XML 2. XSLT Tim Brailsford.
1 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 Stylesheets CSS:Cascading Style Sheets XSL(T):eXtended Stylesheet Language (Transformations)
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:
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.
1 Extensible Stylesheet Language (XSL) Extensible Stylesheet Language (XSL)
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.
1 XSLT XSLT (extensible stylesheet language – transforms ) is another language to process XML documents. Originally intended as a presentation language:
Unit 4 Representing Web Data: XML
ACG 4401 XSLT Extensible Stylesheet Language for Transformations
More XML XML schema, XPATH, XSLT
Unit 6 - XML Transformations
Presentation transcript:

September 15, 2003Houssam Haitof1 XSL Transformation Houssam Haitof

September 15, 2003Houssam Haitof2 XSL XSL (eXtensible Stylesheet Language) is a language for expressing style sheets.

September 15, 2003Houssam Haitof3 What is a Stylesheet? A stylesheet is a file which contains a set of rules for converting an XML document into another document, which can be XML, HTML, plain text …

September 15, 2003Houssam Haitof4 Style Sheet Specifications XSL - Extensible Style Language Combines features of DSSSL and CSS using XML syntax DSSSL - Document Style and Semantics Specification Language An international SGML standard for Scheme-like languages for style sheets and document conversion CSS - Cascading Style Sheet Specification Simple syntax for assigning styles to elements (in some HTML browsers) XSLT is an XML Document!

September 15, 2003Houssam Haitof5 XSL It consists of three parts: XSL Transformations (XSLT): a language for transforming XML documents An XML vocabulary for specifying formatting semantics (XSL Formatting Objects) An expression language used by XSLT to access or refer to parts of an XML document (XPATH)

September 15, 2003Houssam Haitof6 XSL-FO Used to describe XML documents for display W3C recommendation 15 October 2001 A language for completely describing a styled document (content organization, styling, layouts and layout-selection rules) Everything needed to format and paginate a document!

September 15, 2003Houssam Haitof7 XPath Used in conjunction with XSLT Became a W3C recommendation 16 Nov 1999 Provides a language for pointing to different parts of an XML document specifies location path from specific context nodes (i.e. starting points)

September 15, 2003Houssam Haitof8 XPath Expressions Addresses a specific part or parts of XML documents which then allows XSLT to transform them Provides expressions for manipulation of strings, Booleans, numbers so that the XSL elements can act upon them

September 15, 2003Houssam Haitof9 XSLT XSLT is the most important part of the XSL Standard. It is the part of XSL that is used to transform an XML document into another XML document, or another type of document (text, java code, …)

September 15, 2003Houssam Haitof10 XSLT XSLT can be used to manipulate an XML document Can transform/extract information as a programming language can Can be used like a database language to extract information Uses XML syntax

September 15, 2003Houssam Haitof11 XSLT is rule-based XSLT is based on template rules which specify how XML documents should be processed. Template rules can be based in any order because XSLT is a declarative language. The stylesheet declares what output should be produced when a pattern in the XML document is matched.

September 15, 2003Houssam Haitof12 Example A stylesheet could declare that when the XSLT transformation engine finds a 'NAME' element it should add markup by calling the 'NAME' template. The template syntax is:...

September 15, 2003Houssam Haitof13 XSLT Capabilities Add prefix or suffix text to content Remove, create, re-order and sort elements Re-use elements elsewhere in the document Transform data between XML formats Uses a recursive mechanism to go through document

September 15, 2003Houssam Haitof14 XSLT consists of two parts A source document original xml document A result tree newly-created xml, html or a plain text document A common way to describe the transformation process is to say that XSL uses XSLT to transform an XML source tree into an XML result tree.

September 15, 2003Houssam Haitof15 Trees & Nodes With XSLT one does not think in terms of documents, but in terms of trees & nodes A tree represents the data in a document as a set of nodes Nodes are elements, attributes, comments, etc in a hierarchy

September 15, 2003Houssam Haitof16 Structure of Style Sheet style sheet Style sheet is made up of templates Templates have other XSL elements/XPath expressions Style sheet is usually given extension *.xsl Must be well-formed XML XSLT has a number of pre-defined elements to perform certain transformations …

September 15, 2003Houssam Haitof17 A Sample XML file Moby-Dick Herman Melville hardcover 724 $9.95 …

September 15, 2003Houssam Haitof18 A simple transformation of an XML file Book Description Author: Herman Melville Title: Moby-Dick Price: $9.95 Binding type: hardcover Number of pages: 724 Author: John Doe Title: Tales Price: $19.95 Binding type: softcover Number of pages: 450

September 15, 2003Houssam Haitof19 <xsl:stylesheet version ="1.0" xmlns:xsl=" XSLT Test Book Description Author: Title: Price: Binding: Number of Pages:

September 15, 2003Houssam Haitof20 XSL Processor An XSL processor can transform an input XML document to a XML or any other output document based on rules in a second XML document (i.e. a XSLT file)

September 15, 2003Houssam Haitof21 Template Matching XPath is used by XSLT in the match attribute of a template e.g. matches any sentence element. The stylesheet processor goes through the XML document one element at a time, finds the first template which that element matches, and carries out the instructions in that template.

September 15, 2003Houssam Haitof22 Template Matching (cont) If the element does not match any template in the stylesheet, then the default behaviour is for the processing to pass through to the children of this element without carrying out any instructions. When the processing reaches an element which has only text children, the result of processing these children is to print out the text.

September 15, 2003Houssam Haitof23 Some examples of patterns * matches any element / matches the top-level element sentence/word matches any word element with a sentence parent matches any noun element whose pos attribute has the value noun Many other possibilities …

September 15, 2003Houssam Haitof24 Some XSLT Syntax and Elements

September 15, 2003Houssam Haitof25 To begin Start by declaring that this is an xml document Next: declare the processing instruction & the namespace <xsl:stylesheet xmlns:xsl=" m" version="1.0">

September 15, 2003Houssam Haitof26 XSLT Namespace Every XSL file needs to specify the XSL namespace so that the parser knows which version of XSLT to use. <xsl:stylesheet xmlns:xsl=" m" version="1.0"> The namespace prefix xsl: is used in the rest of the XSL file to identify XSL processing statements. If a statement isn't prefixed with xsl:, then it's simply copied to the output without being processed.

September 15, 2003Houssam Haitof27 XSL Elements Before processing can begin, the part of the XML document with the information to be copied to the output must be selected with an XPath expression. The selected section of the document is called a node and is normally selected with the match operator. If the entire document is to be selected, match the root node using match="/". Another approach is to match the document element (the element that includes the entire document).

September 15, 2003Houssam Haitof28 XSL Elements.. The element applies a template rule to the current element or to the current element's child nodes. If we add a select attribute to the element it will process only the child element that matches the value of the attribute.

September 15, 2003Houssam Haitof29 XSL Elements.. allows for processing on a number of nodes in the source tree, one at a time Attributes “select” denotes the path to the nodes Example.. // other xsl elements

September 15, 2003Houssam Haitof30 When the xsl:for-each expression has selected a ‘BOOKS' element, the xsl:value-of expression extracts and copies to the output file the value stored in the selected element. syntax: <xsl:value-of select= Examples XSL Elements..

September 15, 2003Houssam Haitof31 XSL Elements.. Allows for conditional processing. Attribute: test Example

September 15, 2003Houssam Haitof32 XSL Elements.. XSLT can be used to sort elements by alphabetical or numerical order, according to attribute values, text contents, in ascending or descending order, and more …

September 15, 2003Houssam Haitof33 More XSL Elements.. Some of the xsl elements not covered

September 15, 2003Houssam Haitof34 XSLT Thank you!