McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Applying eXtensible Style Sheets (XSL) Ellen Pearlman Eileen Mullin Programming.

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

Inside an XSLT Processor Michael Kay, ICL 19 May 2000.
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.
Technology Reviews :XSL Park, Ho-gun. What is XSL Extensible Style sheet LanguageExtensible Style sheet Language An XML-based language used to.
 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.
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)
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.
1 Copyright (c) [2000]. Roger L. Costello. All Rights Reserved. Using XSLT and XPath to Transform XML Documents Roger L. Costello XML Technologies.
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)
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.
Chapter 12 Creating and Using XML Documents HTML5 AND CSS Seventh Edition.
XML – Extensible Markup Language XML eXtensible – add to language. Markup – delimit info using tags. Language – a way to express info.
Ertan Deniz Instructor.  XML Schema  Document Navigation (Xpath)  Document Transformation (XSLT)
XML for E-commerce III Helena Ahonen-Myka. In this part... n Transforming XML n Traversing XML n Web publishing frameworks.
Copyright © 2012 Accenture All Rights Reserved.Copyright © 2012 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are.
IS432 Semi-Structured Data Lecture 5: XSLT Dr. Gamal Al-Shorbagy.
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
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,
Module Road Map Credit Categories Assignment 2 Credit Category 2 You are able to demonstrate how data may be filtered using Xpath You are able to demonstrate.
 XML is designed to describe data and to focus on what data is. HTML is designed to display data and to focus on how data looks.  XML is created to structure,
 2004 Prentice Hall, Inc. All rights reserved. 1 Chapter 34 - Case Study: Active Server Pages and XML Outline 34.1 Introduction 34.2 Setup and Message.
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.
IST 221 Internet Concepts and Applications Introduction to XML II CSS and XSLT Style Sheets.
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.
Presentation Topic: XML and ASP Presented by Yanzhi Zhang.
Lecture 11 XSL Transformations (part 1: Introduction)
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.
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 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.
 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.
XSLT: How Do We Use It? Nancy Hallberg Nikki Massaro Kauffman.
Chapter 29. Copyright 2003, Paradigm Publishing Inc. CHAPTER 29 BACKNEXTEND 29-2 LINKS TO OBJECTIVES Attach an XML Schema Attach an XML Schema Load XML.
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.
Rendering XML Documents ©NIITeXtensible Markup Language/Lesson 5/Slide 1 of 46 Objectives In this session, you will learn to: * Define rendering * Identify.
Unit 4 Representing Web Data: XML
Displaying XML Data with XSLT
XSLT 1.0.
Chapter 7 Representing Web Data: XML
Applying eXtensible Style Sheets (XSL)
XML WITH CSS.
XSL XSLT and XPath 24-Feb-19.
Unit 6 - XML Transformations
Presentation transcript:

McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Applying eXtensible Style Sheets (XSL) Ellen Pearlman Eileen Mullin Programming the Web Using XML

8-2 Learning Objectives 1.Learn how XSL can transform XML documents into other formats such as HTML 2.Examine how an XSL style sheet consists of a set of rules called templates 3.Discover the three components that comprise XSL: XSLT, XPath, and XSL Formatting Objects 4.Use XSLT to output an XML source document into an XML result document. 5.Use XPath expressions in matching patterns to locate parts of an XML document.

8-3 CSS and XSL You can use XSL to transform documents – for example, to transform XML data into an HTML document with a CSS stylesheet on a Web server. In this way, XSL and CSS complement each other and can even be used together. You can also use XSL to format data based its value – for example, to display negative numbers in a financial report in red.

8-4 Understanding XSL XSL consists of three parts: –XSLT, a language for transforming XML documents –XPath, a language that defines parts of an XML document –XSL Formatting Objects, a vocabulary for styling XML documents

8-5 How XSL Works XSL can filter and sort XML data using the criteria you define, as well as format its display based on the value of the data itself. When it’s output, you can use XSL to send your XML data to various devices, including handhelds, print, or voice output.

8-6 How XSL Works (2) The XSLT processor reads an XML file and an XSLT stylesheet, then outputs another file based on the instructions found in the stylesheet.

8-7 Using XSLT to Transform XML Documents with XSL XSLT is the part of XSL that can turn one XML document into another. XSLT is a template-based programming language. An XSLT template can also introduce new XML elements into the output document it creates, or remove others. XSLT lets different kinds of software applications exchange XML-enabled data with one another.

8-8 Using XSLT to Convert an XML Source Tree Into an XML Result Tree

8-9 How XSLT Works You need two starting documents for an XSLT transformation – an XML “source” document and an XSLT stylesheet – used to create a single "result" document. The XSLT stylesheet is applied to an XML document’s source tree to generate a result tree that is typically saved as an XML or HTML document. Once a match is found, XSLT transforms the matching part of the source document into the result document.

8-10 Learning the Details of XSL Stylesheets Every XSL stylesheet needs to identify the XSL namespace (abbreviated as xslns) so that the parser knows what version of XSLT to use. Accordingly, an XSLT stylesheet statement defines a root element called or. This might appear as: or:

8-11 Example: gamecatalog.xml Escape from Monkey Island Lucas Arts Adventure Windows 95/98/ME USA

8-12 Creating An XSL Stylesheet: gamecatalog.xsl <xsl:stylesheet version="1.0" xmlns:xsl=" My Game Auctions Title Manufacturer

8-13 Adding an XSL Stylesheet Reference to the gamecatalog.xml File Escape from Monkey Island Lucas Arts Adventure Windows 95/98/ME USA

8-14 Viewing the gamecatalog.xml File

8-15 Filtering You can filter the output from an XML document by setting a criterion for the select attribute in the element. For example, change: to: then the results listing would show only games that had been released from Activision.

8-16 Filtering (2) You can filter your data using several operators, not just the equal (=) sign. These include: * =(equal) *! =(not equal) * <(less than) * >(greater than)

8-17 Sorting To sort your output at the same time it’s generated, you add an element within the element in your XSL stylesheet:

8-18 Adding Sorting Capabilities to gamecatalog.xsl <xsl:stylesheet version="1.0" xmlns:xsl=" My Game Auctions Title Manufacturer

8-19 Displaying the gamecatalog.xml File, Sorted by Title

8-20 Creating Conditional Statements A conditional statement in an XSL stylesheet. tests your file’s content with a straightforward true-false condition, applying a template only if that specified condition is true. You can use conditional statements to limit the display of data. The format looks like the following:.

8-21 Adding Conditional Testing to gamecatalog.xsl <xsl:stylesheet version="1.0" xmlns:xsl=" My Game Auctions Title Manufacturer

8-22 The Output of the gamecatalog.xml file, Showing Games That Cost Less Than $30

8-23 Adding a Multiple Conditional Statement to gamecatalog.xsl <xsl:stylesheet version="1.0" xmlns:xsl=" My Game Auctions Title Manufacturer

8-24 Applying a Multiple Conditional Statement to Indicate Which Items Are the Most Recent

8-25 Applying Templates

8-26 Debugging XSLT In the same way that a word processor’s spell- checker can ensure there are no obvious misspellings in your writings, validators and debuggers are essential tools for programmers in reducing or eliminating errors in their code. Often debuggers are built into suites of authoring tools, but you shouldn’t need something that complex to check your own errors. For example, Macromedia’s Dreamweaver is a sophisticated suite of tools for Web designers and developers.

8-27 Using the XSLT Debugging Feature in Altova’s XMLSpy Program

8-28 The Free XSLDebugger Program

8-29 The End