Introduction to XSLT. What is XML? Design Goals of XML XML Format XML Declaration ElementsAttributes.

Slides:



Advertisements
Similar presentations
XML III. Learning Objectives Formatting XML Documents: Overview Using Cascading Style Sheets to format XML documents Using XSL to format XML documents.
Advertisements

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.
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.
XSL Transformations (XSLT) Meghasyam Bokam April’1 st, 2002.
XML: Extensible Markup Language BA Presented by: Tara Barnes, Lauren Jones, Ryan Kline.
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
XML Vikki Brandon Jesse Josh. Quick Facts Who created it? –W3C Jon Bosak and Tim Bray as leaders and major contributors When? –Started in 1996 and finished.
5-1 Facilitating Business over the Internet: The XML language CR (2004) Prentice Hall, Inc. The xml goals The main objects of xml: Diagrams: Blocks and.
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.
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
Using XSLT and XPath to Enhance HTML Documents Reference: Roger L. Costello
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.
XML and XSL Institutional Web Management 2001: Organising Chaos.
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.
XML and friends Part 1 - XML and DTD ELAG 2001 workshop 8 Jan Erik Kofoed © BIBSYS Library Automation.
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
XML The Overview. Three Key Questions What is XML? What Problems does it solve? Where and how is it used?
XP New Perspectives on XML Tutorial 6 1 TUTORIAL 6 XSLT Tutorial – Carey ISBN
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
Extensible Markup and Beyond
Introduction to XML. XML - Connectivity is Key Need for customized page layout – e.g. filter to display only recent data Downloadable product comparisons.
Transforming XML Part II XML Document Transformation with XSLT John Arnett, MSc Standards Modeller Information and Statistics Division NHSScotland Tel:
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.
Tutorial 1: XML Creating an XML Document. 2 Introducing XML XML stands for Extensible Markup Language. A markup language specifies the structure and content.
 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 "
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.
Lecture 11 XSL Transformations (part 1: Introduction)
XML 2nd EDITION Tutorial 1 Creating An Xml Document.
Waqas Anwar Next SlidePrevious Slide. Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language.
XML The “E-Lance Economy” or “Digital Economy” is a new challenge for interacting over networks. XML was developed by the World Wide Web Consortium (W3C)
 2002 Prentice Hall, Inc. All rights reserved. 1 Chapter 12 – XSL: Extensible Stylesheet Language Transformations (XSLT) Outline 12.1Introduction 12.2Setup.
XP 1 Creating an XML Document Developing an XML Document for the Jazz Warehouse XML Tutorial.
Accessing Data Using XML CHAPTER NINE Matakuliah: T0063 – Pemrograman Visual Tahun: 2009.
XML & varieties, e.g. VoiceXML By: Shawn Ramdass, Saji Abraham & Billy Santamorena.
XML Design Goals 1.XML must be easily usable over the Internet 2.XML must support a wide variety of applications 3.XML must be compatible with SGML 4.It.
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.
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.
 XSL – Extensible Style Sheet Language  XSLT – XSL Transformations › Used to transform XML documents to other formats,like HTML or other XML documents.
XSLT: How Do We Use It? Nancy Hallberg Nikki Massaro Kauffman.
XML The Overview. Three Key Questions What is XML? What Problems does it solve? Where and how is it used?
 XML derives its strength from a variety of supporting technologies.  Structure and data types: When using XML to exchange data among clients, partners,
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.
Challenges in XML It’s good… but is it good enough? Siddhesh Bhobe Persistent eBusiness Solutions.
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:
XSLT: The XML transformation language
XML: Extensible Markup Language
Creating an XML Document
Applying eXtensible Style Sheets (XSL)
XML WITH CSS.
CS 431 – February 28, 2005 Carl Lagoze – Cornell University
Presentation transcript:

Introduction to XSLT

What is XML? Design Goals of XML XML Format XML Declaration ElementsAttributes

Design Goals of XML XML shall be straightforwardly usable over the Internet. XML shall support a wide variety of applications. XML shall be compatible with SGML. It shall be easy to write programs which process XML documents. The number of optional features in XML is to be kept to the absolute minimum, ideally zero. XML documents should be human-legible and reasonably clear. The XML design should be prepared quickly. The design of XML shall be formal and concise. XML documents shall be easy to create. Terseness in XML markup is of minimal importance.

XML Format XML contains elements, attributes, and data. An example XML entry would look like: Tom Sawyer Mark Twain XML contains elements, attributes, and data. An example XML entry would look like: Tom Sawyer Mark Twain

XML Declaration The XML Declaration should appear at the top of each XML file and should specify the XML version and the encoding used within the XML. An example XML declaration would look like:

Elements XML Elements are contained within <> symbols and must nest properly. Each node that opens must have a corresponding close node. Nodes can contain attributes, data, and “child” nodes. An example XML element (also called a node) with a single piece of data would look like: Tom Sawyer Tom Sawyer

Attributes An XML Attribute is a single piece of data assigned to an XML Element. If data is assigned as an attribute, the data can not be split further into sub-elements. XML attributes should only be used if the data will never need additional elements created below. An example XML element with an attribute and a single piece of data would look like: Tom Sawyer Tom Sawyer

XSLT Basics What is XSLT? XML Declaration and XSLT Declaration Connecting to an XML Data file

What is XSLT? An XSLT stylesheet utilizes XPath in order to transform the initial XML document into another document. The original XML document must be well formed. The resultant document should also be well formed, though in certain instances, this can be overridden as necessary.

Declarations In addition to the XML declaration, an XSLT stylesheet must specify a style sheet declaration. The style sheet declaration is what enables the XSLT to utilize the binding features. An example XML Style Sheet Declaration would look like:

Connecting to XML Data In order to client-side bind the XML Data with the XSLT Stylesheet, a single line must be added within the XML Data. An example binding line would look like: This line should appear directly beneath the XML Declaration in the XML Data file.

XSLT Tags <xsl:template> <xsl:apply-templates><xsl:value-of> <xsl:sort><xsl:if><xsl:choose> position function mod<xsl:call-template><xsl:copy><xsl:copy-of>

<xsl:template> The element is used to create individual templates within a single stylesheet. These templates can be accessed by simple matching or called directly via the name attribute.

When an XSLT style sheet comes across an tag, the style sheet will look for matching nodes. The matching node is determined by the value located within the match attribute. In this case a forward slash (/). In XSLT, a forward slash represents the root node of the XML data. In this case, the template should be matched only a single time as only a single root node can exist within an XML document.

<xsl:apply-templates> When an XSLT style sheet comes across an tag, the style sheet will compare current nodes with available tags. For each match it comes across (in the current node set), the template will be applied. The select statement can be added to the tag in order to specify the order in which the nodes are processed.

<xsl:value-of> The tag is used to take the value (or attribute value) from an XML element within the XML Data file and use it within the output stream of the stylesheet. The standard use is to write output to the final output.

The tag allows the XSLT to loop through a set of nodes at which point it can use data within each node for output. The is often used to create lists or tables of repeating data. XPath is used to determine which selection will be looped and can include select statements to filter the looped items.

<xsl:sort> The tag can be used within lops in order to sort the nodes before the final output has been created. This is often useful for alphabetizing items within a repeating list.

<xsl:if> The statement allows the XSLT to perform a test on the current node set to see if it meets conditions for continued processing. The statement must contain the entire section it will affect. statements are most often used within loops.

<xsl:choose> The statement is used to select a single instance of multiple possibilities. The first condition that is met will be used, if no condition are met, the statement allows the use of which will be the catch-all condition.

position function The position function is used to determine the current position in the node set. This tag will often be used within loops in order to number the output.

mod Mod has many applications, but the most common is alternating row colors within a table. Because of the nature of mod, the developer can determine how often a pattern repeats (every other row, every third row, etc.).

<xsl:call-template> The tag works very much like with the exception that the developer is able to call a chosen template regardless of the current node in use. This adds the ability to call template that have nested calls whether or not the original template should have been called in the first place.

and and The tag allows the XSLT to create a copy of the currently selected node. The tag is very similar to the tag is very similar to the <xsl:copy” tag but copies the children nodes and data as well.

Old vs New

Questions?