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.

Slides:



Advertisements
Similar presentations
Chapter 7 An Introduction to XML.
Advertisements

What is XML? a meta language that allows you to create and format your own document markups a method for putting structured data into a text file; these.
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.
An Introduction to XML Based on the W3C XML Recommendations.
XSL XSLT and XPath 11-Apr-17.
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.
CS 898N – Advanced World Wide Web Technologies Lecture 21: XML Chin-Chih Chang
Chapter 10 © 2001 by Addison Wesley Longman, Inc. 1 Chapter 10 Sebesta: Programming the World Wide Web.
September 15, 2003Houssam Haitof1 XSL Transformation Houssam Haitof.
Understanding Page Template Components Lila Bronson Training Manager, OmniUpdate, Inc.
Introduction to XML This material is based heavily on the tutorial by the same name at
ECA 228 Internet/Intranet Design I Intro to XML. ECA 228 Internet/Intranet Design I HTML markup language very loose standards browsers adjust for non-standard.
Pemrograman Berbasis WEB XML part 2 -Aurelio Rahmadian- Sumber: w3cschools.com.
XML introduction to Ahmed I. Deeb Dr. Anwar Mousa  presenter  instructor University Of Palestine-2009.
XML Anisha K J Jerrin Thomas. Outline  Introduction  Structure of an XML Page  Well-formed & Valid XML Documents  DTD – Elements, Attributes, Entities.
Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials.
CREATED BY ChanoknanChinnanon PanissaraUsanachote
IS432 Semi-Structured Data Lecture 5: XSLT Dr. Gamal Al-Shorbagy.
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.
1 © Netskills Quality Internet Training, University of Newcastle Introducing XML © Netskills, Quality Internet Training University.
XML 1 Enterprise Applications CE00465-M XML. 2 Enterprise Applications CE00465-M XML Overview Extensible Mark-up Language (XML) is a meta-language that.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 6 XSLT (Based on Møller and Schwartzbach,
What is XML?  XML stands for EXtensible Markup Language  XML is a markup language much like HTML  XML was designed to carry data, not to display data.
 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,
Session IV Chapter 9 – XML Schemas
XML TUTORIAL Portions from w3 schools By Dr. John Abraham.
How do I use HTML and XML to present information?.
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 "
XSLT Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
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.
Softsmith Infotech XML. Softsmith Infotech XML EXtensible Markup Language XML is a markup language much like HTML Designed to carry data, not to display.
E0262 – MIS – Multimedia Storage Techniques XML (Extensible Markup Language  XML is a markup language for creating documents containing structured information.
Windows Presentation Foundation (WPF) Chapter 16 Dr. Abraham.
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.
Introduction to XML This presentation covers introductory features of XML. What XML is and what it is not? What does it do? Put different related technologies.
XML Instructor: Charles Moen CSCI/CINF XML  Extensible Markup Language  A set of rules that allow you to create your own markup language  Designed.
Lecture 16 Introduction to XML Boriana Koleva Room: C54
Accessing Data Using XML CHAPTER NINE Matakuliah: T0063 – Pemrograman Visual Tahun: 2009.
XML EXtensible Markup Language. Agenda Introduction to XML XML Rules XML Elements XML Attributes XML Validation XML Exercises XML Namespaces XML CDATA.
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.
XML Basics A brief introduction to XML in general 1XML Basics.
Unit 10 Schema Data Processing. Key Concepts XML fundamentals XML document format Document declaration XML elements and attributes Parsing Reserved characters.
XML A Language Presentation. Outline 1. Introduction 2. XML 2.1 Background 2.2 Structure 2.3 Advantages 3. Related Technologies 3.1 DTD 3.2 Schemas and.
Unit 3 — Advanced Internet Technologies Lesson 11 — Introduction to XSL.
University of Nottingham School of Computer Science & Information Technology Introduction to XML 2. XSLT Tim Brailsford.
XML CSC1310 Fall HTML (TIM BERNERS-LEE) HyperText Markup Language  HTML (HyperText Markup Language): December  Markup  Markup is a symbol.
XSLT: How Do We Use It? Nancy Hallberg Nikki Massaro Kauffman.
C Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Introduction to XML Standards.
CIS 228 The Internet 9/20/11 XHTML 1.0. “Quirks” Mode Today, all browsers support standards Compliant pages are displayed similarly There are multiple.
 XML derives its strength from a variety of supporting technologies.  Structure and data types: When using XML to exchange data among clients, partners,
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 Introduction to XML Extensible Markup Language.
XML Schema – XSLT Week 8 Web site:
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)
Extensible Markup Language (XML) Pat Morin COMP 2405.
Unit 4 Representing Web Data: XML
Extensible Markup Language XML
Extensible Markup Language XML
Chapter 7 Representing Web Data: XML
Roy Tennant California Digital Library
Allyson Falkner Spokane County ISD
Presentation transcript:

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 Rules Tag Name Rules Comments & Processing Instructions Comments & Processing Instructions XML Validation XML Validation XML Name Space XML Name Space Special Character Entities Special Character Entities XML Example XML Example Displaying XML with CSS Displaying XML with CSS

Outline Contd… What is XSL? Transforming XML: XSLT An Example Nodes and Xpath XPath Essentials Templates Calling Templates

Outline Contd… Push vs. Pull Processing Selecting Elements and Attributes Decision Structure: Choose Decision Structure: If Looping XSLT Example XML to XHTML on the Server Conclusion

What is XML? XML stands Markup Language XML stands for EXtensible Markup Language XML was designed to describe XML was designed to describe data XML tags are not predefined. You must define your own tags XML uses a Document Type Definition (DTD) or an XML Schema to describe the data

Well-formed XML Tags must be suitably named Tags must be suitably named Single Root Element Single Root Element Follows general tagging rules: All tags begin and end But can be minimized if empty: instead of All tags are case sensitive All tags must be properly nested William Russell All attribute values are quoted W.Shakespeare

Tag Name Rules Must start with letter, colon or underscore Must start with letter, colon or underscore Must only letters and numbers Must only letters and numbers characters - _. : characters - _. : The colon is reserved for W3C use The colon is reserved for W3C use

Comments & Processing Instructions You can embed comments in your XML just like in HTML : You can embed comments in your XML just like in HTML : A processing instruction tells the XML parser information it needs to know to properly process an XML document

XML Validation Uses only specific tags and rules as codified by one of A document type definition (DTD) A schema definition Only the tags listed by the schema or DTD can be used Software can take a DTD or schema and verify that a document adheres to the rules

XML Name Space XML Namespaces provide a method to avoid element name conflicts. This XML document carries information in a table: Food This XML document carries information about a table: London 100 Miles If these two XML documents were added together, there would be an element name conflict because both documents contain a element with different content and definition.

Solving Name Conflicts using a Prefix This XML document carries information in a table: This XML document carries information in a table: Food This XML document carries information about a city: London London 100 Miles 100 Miles

Using Namespaces This XML document carries information in a table: Food Food </h:table> This XML document carries information about a city: London London 100 Miles 100 Miles </f:table>

The XML Namespace (xmlns) Attribute The XML namespace attribute is placed in the start tag of an element and has the following syntax: xmlns:namespace-prefix="namespaceURI" The address used to identify the namespace is not used by the parser to look up information. The only purpose is to give the namespace a unique name. However, very often companies use the namespace as a pointer to a real Web page containing information about the namespace.

Special Character Entities There are 5 characters that are reserved for special purposes; therefore, to use these characters when not part of XML tags, you must use an entity reference: There are 5 characters that are reserved for special purposes; therefore, to use these characters when not part of XML tags, you must use an entity reference: & (ampersand) becomes: & & (ampersand) becomes: & < (less than) becomes: < < (less than) becomes: < > (greater than) becomes: > > (greater than) becomes: > (apostrophe) becomes: &apos; (apostrophe) becomes: &apos; (quote) becomes: " (quote) becomes: "

XML Example <bookstore> W.Shakespeare W.Shakespeare Hamlet Hamlet W.Shakespeare W.Shakespeare Macbeth Macbeth </bookstore>

Displaying XML with CSS Must put a processing instruction at the top of your XML file (but below the XML declaration): Example style.css book{ font-size:12; }

What is XSL? XSL stands for EXtensible Stylesheet Language. XSL stands for EXtensible Stylesheet Language. XSL describes how the XML document should be displayed! This is the Preferred language for processing XML. XSL describes how the XML document should be displayed! This is the Preferred language for processing XML. XSL consists of three parts: XSL consists of three parts: XSLT - XSLT - a language for transforming XML documents XPath - XPath - a language for navigating in XML documents XSL-FO - XSL-FO - a language for formatting XML documents

Transforming XML: XSLT XML Stylesheet Language Transformations (XSLT) XML Stylesheet Language Transformations (XSLT) A markup language and programming syntax for processing XML A markup language and programming syntax for processing XML Is most often used to: Is most often used to: Transform XML to HTML for delivery to standard web clients Transform XML to HTML for delivery to standard web clients Transform XML from one set of XML tags to another Transform XML from one set of XML tags to another Transform XML into another syntax/system Transform XML into another syntax/system

Example: XML Document: XML Document: Hello, World! Hello, World! Desired Output: Desired Output: Greeting Greeting Hello, World! Hello, World! XSLT Stylesheet: XSLT Stylesheet: Greeting

XLST XSLT is based on the process of matching templates to nodes of the XML tree XSLT is based on the process of matching templates to nodes of the XML tree Working down from the top, XSLT tries to match segments of code to: Working down from the top, XSLT tries to match segments of code to: The root element The root element Any child node Any child node And on down through the document And on down through the document We can specify different processing for each element if you wish We can specify different processing for each element if you wish

Nodes and XPath An XML document is a collection of nodes that can be identified, selected, and acted upon using an Xpath statement An XML document is a collection of nodes that can be identified, selected, and acted upon using an Xpath statement Examples of nodes: root, element, attribute, text Examples of nodes: root, element, attribute, text

XPath Essentials //book = Select all elements of the root node //book = Select all elements of the root node = Select all elements of the root node that have a sno attribute with the value 1 = Select all elements of the root node that have a sno attribute with the value 1 //book/author = Select all elements that have an element as a parent //book/author = Select all elements that have an element as a parent A period (.) denotes the current context node (e.g.,./author selects any author tag that is a child of the current node A period (.) denotes the current context node (e.g.,./author selects any author tag that is a child of the current node Two periods (..) denote the parent node of the current context Two periods (..) denote the parent node of the current context

Templates An XSLT stylesheet is a collection of templates that act against specified nodes in the XML source tree For example, this template will be executed when a element is encountered:

Calling Templates A template can call other templates By default (tree processing): [processes all children of the current node] [processes all children of the current node] Explicitly: [processes all elements of the current node] [processes all elements of the current node] [processes the named template, regardless of the source [processes the named template, regardless of the source tree] tree]

Push vs. Pull Processing In push processing, the source document controls the order of processing (e.g., CSS is strictly pull processing); e.g., Pull processing can address particular elements in the source tree regardless of position in the source document; e.g., =//title/>

Selecting Elements and Attributes : To select the contents of a particular element, use this statement: To select the contents of an attribute of a particular element, use an XPath statement like:

Decision Structure: Choose A way to process data differently based on specified criteria; if you dont need otherwise, you can use CODE HERE TO BE EXECUTED IF THE STATEMENT IS TRUE CODE HERE TO BE EXECUTED IF THE STATEMENT IS TRUE CODE HERE TO BE EXECUTED IF THE STATEMENT IS TRUE CODE HERE TO BE EXECUTED IF THE STATEMENT IS TRUE DEFAULT CODE HERE, IF THE ABOVE TWO TESTS FAIL

Decision Structure: If A decision structure when you dont need a default decision (otherwise use xsl:choose instead) TRUE CODE HERE TO BE EXECUTED IF THE STATEMENT IS TRUE CODE HERE TO BE EXECUTED IF THE STATEMENT IS TRUE

Looping XSLT looping selects a set of nodes using an Xpath expression, and performs the same operation on each; e.g., CODE HERE

XML to XHTML on the Server Following is the ASP source code for transforming XML file to XHTML on the server: Following is the ASP source code for transforming XML file to XHTML on the server: <% <% 'Load XML 'Load XML set xml = Server.CreateObject("Microsoft.XMLDOM") set xml = Server.CreateObject("Microsoft.XMLDOM") xml.async = false xml.async = false xml.load(Server.MapPath("bookstore.xml")) xml.load(Server.MapPath("bookstore.xml")) 'Load XSL 'Load XSL set xsl = Server.CreateObject("Microsoft.XMLDOM") set xsl = Server.CreateObject("Microsoft.XMLDOM") xsl.async = false xsl.async = false xsl.load(Server.MapPath("bookstore.xsl")) xsl.load(Server.MapPath("bookstore.xsl")) 'Transform file 'Transform file Response.Write(xml.transformNode(xsl)) Response.Write(xml.transformNode(xsl)) %> %>

Conclusion Begin transitioning to XML now: Begin transitioning to XML now: XHTML and CSS for web files, XML for static documents with long-term worth XHTML and CSS for web files, XML for static documents with long-term worth Do not rely on browser support of XML

Thank You Happy Programming!!!!!!