1 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 Stylesheets CSS:Cascading Style Sheets XSL(T):eXtended Stylesheet Language (Transformations)

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.
Advanced XSLT II. Iteration in XSLT we sometimes wish to apply the same transform to a set of nodes we iterate through a node set the node set is defined.
Advanced XSLT II. Iteration in XSLT we sometimes wish to apply the same transform to a set of nodes we iterate through a node set the node set is defined.
CG0119 Web Database Systems Parsing XML: using SimpleXML & XSLT.
XSLT 11-Apr-17.
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.
XSLT (eXtensible Stylesheet Language Transformation) 1.
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.
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.
XML Unit 6 October 31. XML, review XML is used to markup data Used to describe information Uses tags like HTML –But all tags are user-defined –Must be.
XSLT Stylesheets Some more advanced examples (adapted from the Edinburgh LT site)
XML Extensible Markup Language Standard supported by W3C (World Wide Web Consortium) HTML – End user oriented (presentation) XML – Application oriented.
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 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
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)
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.
10/06/041 XSLT: crash course or Programming Language Design Principle XSLT-intro.ppt 10, Jun, 2004.
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.
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.
 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.
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.
JSTL, XML and XSLT An introduction to JSP Standard Tag Library and XML/XSLT transformation for Web layout.
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.
Lecture 11 XSL Transformations (part 1: Introduction)
 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.
ITB Web programming for E- Commerce 1 ITB6227 Programming for E-COMMERCE Lecture Presentation of XML Documents.
ACG 6415 XSLT Presenting XML and XBRL. Re-Purpose  The main benefit of XML / XBRL Reusability of Data contained in Instance Document We need a method.
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 cs XSL XSL is a standard that consists of three parts: XPath (navigation in documents) XPath was taught in the DB course, so it will not be.
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.
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.
ACG 4401 XSLT Extensible Stylesheet Language for Transformations Presenting XML and XBRL.
XSLT: How Do We Use It? Nancy Hallberg Nikki Massaro Kauffman.
ACG 4401 XSLT Extensible Stylesheet Language for Transformations Presenting XML and XBRL.
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 XSLT XSLT (extensible stylesheet language – transforms ) is another language to process XML documents. Originally intended as a presentation language:
Module Road Map Document Transformations Web Form (ASPX) HTML Form.
XSLT 1.0.
ACG 4401 XSLT Extensible Stylesheet Language for Transformations
CS 431 – February 28, 2005 Carl Lagoze – Cornell University
Unit 6 - XML Transformations
Presentation transcript:

1 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 Stylesheets CSS:Cascading Style Sheets XSL(T):eXtended Stylesheet Language (Transformations)

2 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 CSS CSS is known from HTML Specifies how the viewer shall format the individual tags

3 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 A html file Disney Corp. Employees Donald Duck Mickey Mouse Projects Second project: Paradisvej 111 First project: Consert house Sum of time spend is 561

4 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 Looks like this in MSIE 7.0

5 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 A CSS stylesheet <!-- h2 { font-family: Arial, Helvetica, sans-serif; font-size: 16px; font-style: oblique; color: #FFFF00; background-color: #CC0000; border: medium dashed #000000; } body { font-family: "Courier New", Courier, mono; font-size: 14px; font-style: normal; color: #0000FF; background-color: #00FF33; } --> Disney Corp. In the html- document In the browser

6 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 XML documents can be formatted with CSS Donald Duck Mickey Mouse

7 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 The stylesheet Employee { display: block; font-family: "Courier New", Courier, mono; font-size: 14px; font-style: normal; color: #0000FF; background-color: #00FF33; } Project { display: block; font-family: Arial, Helvetica, sans-serif; font-size: 16px; font-style: oblique; color: #FFFF00; background-color: #CC0000; border: medium dashed #000000; } Project:before { content: attr(ProjectName);} Doesn't work with MSIE 7, but does in Firefox

8 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 The result MSIE 7.0Firefox 2.0

9 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 Advances/drawbacks in using css for formatting xml Some advances –Oriented against formatting –Known from html –Internet Explorer 5+ and Mozilla/Firefox can show css Some drawbacks: –Can not collect a node in one place and use it in another –Can not handle siblings –Do not have control structures (if, foreach....) –Can not make calculation and store variables –Is browser dependent e.g. how do you show attributes in MSIE? XSL and CSS may be combined –Then formatting is done by css and transforming with xsl.

10 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 XSL: Extensible Stylesheet Language Transformations (XSLT) Is used for transforming XML-documents –Transform an XML document in one language to another XML-document in another language –Use XPath to locate nodes in the tree –Construct a transformation for the node –Use an xsl-processor to do the work XSLT-documents contains template rules –A template rule has a pattern specifying the nodes it matches and template to be instantiated and output when a match is found.

11 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 XSLT processors An XSLT-processor transforms one XML-tree into another MS Internet Explorer 5.5+ Server side and in applications: –Apache Xalan as jar or dll. Source code in Java and C++. Might be used together with java based webservers (as Apache ;-). But also with other applications. –MSXML dll Can be used with MS Information Server Integrated in.Net But also in other applications And probably many more Make your own

12 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 A XML document Use this stylesheet as default. Transforms XML to HTML

13 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 A XSL document Donald Duck Mickey Mouse

14 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 Stylesheet A XSLT document is a XML-document itself xsl:stylesheet is the root element in the document.

15 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 Template The template element matches specific nodes Uses XPATH statement in the match criteria In XSLT, there are two trees: a source tree and a result tree –The source tree is the original tree –The result tree is the result of the transformation e.g. a html document or a reduced data set It is only possible to transform to documents that can be described as trees e.g. html and rtf but not pdf The templates describes how to transform the nodes in the source tree

16 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 For each root element: Insert og The result of the transformations of nodes below the root are insert by An example - Transformation of root Continue...

17 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 Foreach Employee element: Insert the value of the name attribute and the xhtml-tag into the result In XPath attributes are referred and elements without. An example - Transformation of

18 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 Donald Duck Mickey Mouse Is a tree structure The result

19 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 In a Picture company.xml company.xsl XSLT Processor Input structure to the XSLT-processor Control program to the XSLT-processor company2.xml Output from the XSLT-processor Browser Might be xhtml company3.html company.css Input to other programs

20 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 Iteration XSLT makes it possible to: –Itererate through the nodes Element for-each –Sort nodes Element sort –Attribut ascending (i.e., A-Z) –Attribut descending (i.e., Z-A)

21 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 Employees Projects It is possible to iterate through the elements – may replace recursion. Iteration Insert title in the document Foreach employee element Sort by name

22 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 Disney Corp. Employees Donald Duck Mickey Mouse Projects Paradisvej 111 Concert house The result

23 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 Conditions Use conditions –As the statement –Use element Similar to the switch statement in Java or C# Has the child elements and – element: The content is used with the condition is true – element: used when no conditions i the elements is true

24 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 First project: Second project: Another project is simlar to a switch-statement in Java or C# Example - Conditions Condition

25 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 Copy nodes Copy nodes directly from source tree to result tree –makes a copy of the node. –places it on the given place in the result tree. –Child nodes and attributes are not copied –Makes a copy of the sub tree –Does also copy childs, attributes etc.

26 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 Variables It is possible to declare variables with The variable can later be referred with $varnavn Sum is declared and assigned to the value of Sum of time spend is

27 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 XsltProc Can be download from xmlsoft.com But easier: Unpack the XsltProc.zip to the folder of the xml and xsl files Result XSL-fileXML-file

28 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 Result Disney Corp. Employees Donald Duck Mickey Mouse Projects First project: Concert house Second project: Paradisvej 111 Sum of time spend is 561 In the browser

29 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 Supplementary reading etc. Peters XML-editor – freewww.iol.ie/~pxe skew.org/xml/stylesheets/treeview/html/ Example of advanced stylesheet, that can show a xml treeskew.org/xml/stylesheets/treeview/html/ GNU based xml-tools. Developed to Linux, but there are versions for Windows and Solaris.