Sheet 1XML Technology in E-Commerce 2001Lecture 6 XML Technology in E-Commerce Lecture 6 XPointer, XSLT.

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

Chungnam National University DataBase System Lab
XML III. Learning Objectives Formatting XML Documents: Overview Using Cascading Style Sheets to format XML documents Using XSL to format XML documents.
UFCE8V-20-3 Information Systems Development 3 (SHAPE HK) Lecture 12 Extensible Stylesheet Language Transformations : XSLT.
 2001 Prentice Hall, Inc. All rights reserved. 1.
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.
XML Technology in E-Commerce
+ 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.
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.
We Need Smart XML Processing HTML has ultra-complex semantics XML has no semantics Something must bridge the gap  A program ?  A clear set of data semantics?
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.
Cornell CS 502 More XML XML schema, XPATH, XSLT CS 502 – Carl Lagoze – Cornell University.
CS 4408 Lecture 9. XSLT instruction elements We have seen that a template can contain non-XSLT text, canned text that it inserts into the result tree.
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.
Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design.
Introduction to XSLT & its use in Grainger Library full-text & metadata projects Thomas G. Habing Grainger Engineering Library Presentation to ASIS&T,
Overview of XPath Author: Dan McCreary Date: October, 2008 Version: 0.2 with TEI Examples M D.
10/06/041 XSLT: crash course or Programming Language Design Principle XSLT-intro.ppt 10, Jun, 2004.
CSE3201/CSE4500 XPath. 2 XPath A locator for elements or attributes in an XML document. XPath expression gives direction.
Scientific Markup Languages Birds of a Feather A 10-Minute Introduction to XML Timothy W. Cole Mathematics Librarian & Professor of.
XML for E-commerce III Helena Ahonen-Myka. In this part... n Transforming XML n Traversing XML n Web publishing frameworks.
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
Representing Web Data: XML CSI 3140 WWW Structures, Techniques and Standards.
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.
Introduction to XML Eugenia Fernandez IUPUI. What is XML? From the World Wide Web Consortium (W3C) The Extensible Markup Language (XML) is the universal.
WORKING WITH XSLT AND XPATH
Session II Chapter 2 – Chapter 2 – XSLhttp://
1 © Netskills Quality Internet Training, University of Newcastle Introducing XML © Netskills, Quality Internet Training University.
Sheet 1XML Technology in E-Commerce 2001Lecture 7 XML Technology in E-Commerce Lecture 7 XSL Formatting Objects, Java Data Binding.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 6 XSLT (Based on Møller and Schwartzbach,
Representing Web Data: XML CSI 3140 WWW Structures, Techniques and Standards.
XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML.
Lecture 14 Extensible Stylesheet Language Transformations : XSLT.
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 "
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.
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.
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.
Sheet 1XML Technology in E-Commerce 2001Lecture 2 XML Technology in E-Commerce Lecture 2 Logical and Physical Structure, Validity, DTD, XML Schema.
XP New Perspectives on XML, 2 nd Edition Tutorial 8 1 TUTORIAL 8 CREATING ELEMENT GROUPS.
Unit 3 — Advanced Internet Technologies Lesson 11 — Introduction to XSL.
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.
XSLT: How Do We Use It? Nancy Hallberg Nikki Massaro Kauffman.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
CHAPTER NINE Accessing Data Using XML. McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Introduction The eXtensible.
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.
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)
Unit 4 Representing Web Data: XML
Chapter 7 Representing Web Data: XML
More XML XML schema, XPATH, XSLT
Unit 6 - XML Transformations
Presentation transcript:

Sheet 1XML Technology in E-Commerce 2001Lecture 6 XML Technology in E-Commerce Lecture 6 XPointer, XSLT

Sheet 2XML Technology in E-Commerce 2001Lecture 6 XPointer –Purpose: specifying fragment identifiers for XML documents; –Points and Ranges; –Extensions to XPath; –XPointer Forms; XSLT –Rendering XML; –XSL Suite; –Example; –XSLT Elements; Lecture Outline

Sheet 3XML Technology in E-Commerce 2001Lecture 6 XML XML Namespaces XPath XPointerXSLT XLink XML Schema XML Languages Parser DOMSAX Software Application Overview

Sheet 4XML Technology in E-Commerce 2001Lecture 6 Fragment Identifiers The part after “#” character in URIs is called fragment identifier: Fragment identifier specifies retrieval action on the resource; The syntax and interpretation of fragment identifiers are media dependent;

Sheet 5XML Technology in E-Commerce 2001Lecture 6 XPointer Specifies language for expressing fragment identifiers for XML documents; Addresses internal structures of XML documents; Extends XPath; Provides facilities for: –selection of a specific position in an XML document; –selection of a range in an XML document; Current status: Working Draft;

Sheet 6XML Technology in E-Commerce 2001Lecture 6 Points and Ranges img competition resultsphotos img name John SmithD. WarwickM. Douglas Point 1 Container: Text Index: 5 Range Point 2 Container: Text Index: 2 Range Point 1 Container: photos Index: 0 Point 2 Container: photos Index: 2 DOM representation of a sample XML document:

Sheet 7XML Technology in E-Commerce 2001Lecture 6 XPointer Terms Point - position in XML information. Consists of container node and index; Range - all the information between two end points; Location - XPath’s nodes plus points and ranges; Location set - ordered list of locations. Usually a result of XPointer expression; Location and Location set are a generalization of XPath’s Node and Node set

Sheet 8XML Technology in E-Commerce 2001Lecture 6 Extensions to XPath XPath allows locating subset of nodes; XPointer allows locating parts that are not nodes. Points and Ranges extend the notion of Node; XPointer expression yields object of type location set; Evaluation is made relatively to the root node of an XML document. The test for points and ranges uses point and range keywords;

Sheet 9XML Technology in E-Commerce 2001Lecture 6 XPointer Forms Full XPointers: 02’])” Bare names: short syntax for id() function: xpointer(id(“author02”)) xlink:href=“/contacts.xml#author02”

Sheet 10XML Technology in E-Commerce 2001Lecture 6 XPointer Functions range-to(expr). The start point is the context location. The end point is returned by the evaluation of expr; xpointer(id("chap1")/range-to(id("chap2"))) string-range(location-set, string). For each location in location-set, the function returns string ranges that match the string argument; string-range(//title,”Introduction")[4]

Sheet 11XML Technology in E-Commerce 2001Lecture 6 Summary on XPointer Specifies fragment identifiers in URIs; Still unstable, working draft status; Based on XPath; Implementations: –Fujitsu XLink Processor ; –libxml; –4XPointer;

Sheet 12XML Technology in E-Commerce 2001Lecture 6 XPointer –Purpose; –Points and Ranges; –Extensions to XPath; –XPointer Forms; XSLT –Rendering XML; –XSL Suite; –Example; –XSLT Elements; Lecture Outline

Sheet 13XML Technology in E-Commerce 2001Lecture 6 Rendering XML HTML specifies how the documents are rendered; In general, XML-based languages do not specify how the documents are rendered; Problem: How to render XML documents on different devices? XML Document

Sheet 14XML Technology in E-Commerce 2001Lecture 6 Rendering XML Solutions: –Attach CSS stylesheet; –Transformation in another document language understood by a particular device; XML Document CSS Stylesheet Browser Transformation FO Document HTML WML ? PDF

Sheet 15XML Technology in E-Commerce 2001Lecture 6 XSL XSL - Extensible Stylesheet Language. Language for expressing stylesheets; Two parts: –XSLT (Extensible Stylesheet Language for Transformations): Language for specifying transformations of XML documents. W3C Recommendation; –XSL Formatting Objects (XSL FO): XML vocabulary for expressing formatting semantics. W3C Candidate Recommendation; XSL W3C site:

Sheet 16XML Technology in E-Commerce 2001Lecture 6 Example What we have: Deitel XML Primer Paul Deitel Welcome Easy XML XML Elements? Entities

Sheet 17XML Technology in E-Commerce 2001Lecture 6 What we want: Example ISBN x - Deitel XML Primer Deitel XML Primer Deitel, Paul Preface 1 Welcome (2 pages ) Chapter 1 Easy XML (4 pages ) Chapter 2 XML Elements? (2 pages ) Appendix 1 Entities (9 pages )

Sheet 18XML Technology in E-Commerce 2001Lecture 6 XSLT Basic Terms Transformation expressed in XSLT is called stylesheet; Stylesheet transforms a source tree into a result tree; Stylesheet is a set of template rules; Rules have two parts: –Pattern: selects nodes from the source tree. Uses XPath syntax; –Template: instantiated in order to form a part of the source tree; Source and result tree roughly conform to the XPath data model;

Sheet 19XML Technology in E-Commerce 2001Lecture 6 XSLT General Processing Scheme Stylesheet expressed in XSLT XSLT Processor Source tree Result tree

Sheet 20XML Technology in E-Commerce 2001Lecture 6 Source tree Result tree Instantiates Stylesheet XSLT Rule matching and Template Instantiation Rule 1 Rule 2 Rule 3 Matches

Sheet 21XML Technology in E-Commerce 2001Lecture 6 Demo Demo - modified version of Deitel 12.5, fig and 12.9, page 327; Tools: –XML Spy 3.5; –XSLT Processor: MSXML 3 Or any downloadable extension for Spy, e.g. Infoteria iXSLT or SAXON; Demo files: –book.xml; –style.xsl;

Sheet 22XML Technology in E-Commerce 2001Lecture 6 Demo Explained Stylesheet root element: ………………………………………………………….. Stylesheet contains elements from XSLT namespace. They are recognized and executed by the XSLT processor; Stylesheet includes non-XSLT elements. They can reside in their own namespace;

Sheet 23XML Technology in E-Commerce 2001Lecture 6 Template Rules First, the root node of the source tree is mapped to html element, which is the root element of all HTML documents, i.e. the root node of the result tree: processes all children of the current node. In our case the current node is the root node;

Sheet 24XML Technology in E-Commerce 2001Lecture 6 Getting Text from Source Tree ISBN - -, ………………………………………………… Element value-of:

Sheet 25XML Technology in E-Commerce 2001Lecture 6 Repetition Creating the table and the first row: ………… Preface ( pages ) for-each element instantiates the template for each node selected by the pattern. The selected node becomes the current node for the template;

Sheet 26XML Technology in E-Commerce 2001Lecture 6 Creating Elements We can reformulate a part of the previous template by using element XSLT element: Preface ( pages ) The template contained in the element, becomes the content of the element with name td in the result tree;

Sheet 27XML Technology in E-Commerce 2001Lecture 6 Creating Attributes We can reformulate a part of the previous template by using attribute XSLT element: Preface ( pages ) right Preface ( pages )

Sheet 28XML Technology in E-Commerce 2001Lecture 6 Copying Nodes XSLT element copy copies the current node and includes it in the result tree; The attributes and children are not copied; The template of the copy element generates their content; Example - identity transformation:

Sheet 29XML Technology in E-Commerce 2001Lecture 6 Demo Using XSLT to test the XPath expressions Demo - uses the file from Deitel Ex11.3, fig , page 316; Tools: –XML Spy 3.5; –XSLT Processor: MSXML 3 Or any downloadable extension for Spy, e.g. Infoteria iXSLT or SAXON; Demo files: –transactions.xml; –xpath.xsl;

Sheet 30XML Technology in E-Commerce 2001Lecture 6 Processing Model At each step we have a list of source nodes; At the first step the list contains the root node; Each node is processed by finding the template rules with pattern that matches the node; Only one rule is selected; The template rule is instantiated with the node as a current node; XSLT instructions in the template are executed. They add new source nodes for processing; The process stops when the list of source nodes is empty;

Sheet 31XML Technology in E-Commerce 2001Lecture 6 Summary on XSLT Powerful transformation language for XML documents based on XML syntax; Allows multiple representations of a single document; Available software implementations: –MSXML 3; –iXSLT for Infoteria; –Saxon; –Xalan-Java, Xalan-C++, part of Apache XML Project; –XT;

Sheet 32XML Technology in E-Commerce 2001Lecture 6 Summary on XSLT (2) Read: Deitel 12; Assignment: Deitel Ex 12.3, Ex 12.7, page 351. For some hints see the course web site.