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.

Slides:



Advertisements
Similar presentations
Introduction to XSL XSL-BASIC ELEMENTS. Transforming XML XSL file 1 XSLT Processor WML fileXSL file 2HTML fileXML file Contenuto Forma Documento.
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.
Transforming XML XMLNamespaces, XSLT. XML Namespaces Sometimes it is necessary to mix XML elements –Different types of content –Use of markup to convey.
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. Branching in XSLT XSLT is functional programming –The program evaluates a function –The function transforms one structure into another.
Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.
CG0119 Web Database Systems Parsing XML: using SimpleXML & XSLT.
Internet Technologies1 1 Lecture 4: Programming with XSLT.
1 XSLT – eXtensible Stylesheet Language Transformations Modified Slides from Dr. Sagiv.
XSLT (eXtensible Stylesheet Language Transformation) 1.
XSL XSLT and XPath 11-Apr-17.
1 CP3024 Lecture 9 XML revisited, XSL, XSLT, XPath, XSL Formatting Objects.
XSLT Stylesheets Some more advanced examples (adapted from the Edinburgh LT site)
XSLT eXtensible Stylesheet Language Transformations Naveed Arshad.
Processing XML Processing XML using XSLT Processing XML documents with Java (DOM) Next week -- Processing XML documents with Java (SAX)
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.
XSL Unit 6 November 2. XSL –eXtensible Stylesheet Language –Basically a stylesheet for XML documents XSL has three parts: –XSLT –XPath –XSL-FO.
A note on generating text with the xsl:value-of instruction.
Internet Technologies XSLT Processing XML using XSLT Using XPath Escaping to Java.
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
1 Copyright (c) [2002]. Roger L. Costello. All Rights Reserved. Using Extension Elements and Extension Functions with XSLT and XPath Roger L. Costello.
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)
Manohar – Why XML is Required Problem: We want to save the data and retrieve it further or to transfer over the network. This.
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.
Sheet 1XML Technology in E-Commerce 2001Lecture 6 XML Technology in E-Commerce Lecture 6 XPointer, XSLT.
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
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.
CSE3201/CSE4500 Information Retrieval Systems XSLT – Part 2.
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.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter X IXXXXXXXXXX XXXXXX.
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.
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.
XP New Perspectives on XML, 2 nd Edition Tutorial 8 1 TUTORIAL 8 CREATING ELEMENT GROUPS.
Dr. Chunbo Chu Week 3. XML Not a replacement for HTML. XML and HTML were designed with different goals: XML was designed to transport and store data,
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.
 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.
CSE3201/CSE4500 Information Retrieval Systems XSLT – Part 2.
XP 1 XSLT II Robin Burke ECT 360. XP 2 Outline Conditionals Numbering Functions and operators Variables and parameters Named and recursive templates.
XP 1 XSLT II Robin Burke ECT 360. XP 2 Homework #4 Forgot we hadn't covered "choose" becomes extra credit My books.xml didn't include descriptions.
Designing Streamable XPath Expressions Roger L. Costello January 5,
1 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 Stylesheets CSS:Cascading Style Sheets XSL(T):eXtended Stylesheet Language (Transformations)
XSLT: How Do We Use It? Nancy Hallberg Nikki Massaro Kauffman.
1 Extensible Stylesheet Language (XSL) Extensible Stylesheet Language (XSL)
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.
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:
Module Road Map Document Transformations Web Form (ASPX) HTML Form.
Chapter X IXXXXXXXXXXXXXXXX.
CS 431 – February 28, 2005 Carl Lagoze – Cornell University
Querying XML XSLT.
EXTENDING COMPONENTS AND TABLE TRANSFORMATIONS WITH XSL
Unit 6 - XML Transformations
Presentation transcript:

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 by an XPath expression we use a for-each element to control the iteration

Applies processing to all nodes in a given node set select attribute contains XPath expression defining the node set the current node changes at each iteration of for-each –changes the context for transforms of content

example we have XML data for a tutorial, divided into sections we wish to produce a numbered contents list in HTML we use for-each twice to create a numbered heading and a list of sections we use the position() function for the numbering

XML Tutorial XML and DTDs XPath and XSLT The Data

Section 1. XML Tutorial 1. XML and DTDs 2. XPath and XSLT … and so on for each section The Desired Output

Section.. </xsl:template

example - notes for-each select=section selects all section nodes in the current tutorial –position() will number the sections in document order for-each select=panel selects all panel nodes in the current section this is just a nested loop!

modes Sometimes you may wish to transform the same node in more than one way The transform for a node is defined in a template A mode attribute is available for template and apply-templates elements This allows more than one template to be defined for any node

example XML data for a famous scientists website The data contains a name element for each person featured on the site. We use mode to achieve two different presentations of name –table of contents –personal data entry

Alan Turing computer scientist mathematician cryptographer The Data

Richard P Feynman physicist playing the bongoes The Data

The Desired Output Turing, Alan Feynman, Richard Name: Alan Turing Born: 1912 Died: 1954 Professions: computer scientist, mathematician, cryptographer Hobbies: none known

<xsl:stylesheet version = 1.0 xmlns:xsl= > Famous Scientists <xsl:apply-templates select = person mode = toc />

,

Name: Born: Died:

attribute value templates allows attribute values derived from the source to be set in the output example <name first = {first_name} initial = {middle_initial} last = {last_name} />

specifies a particular template to be invoked perhaps not related directly to a node-set –e.g. to add boilerplate start_html markup template must have a name attribute calls the template by name

<!Interesting stuff that generates the masthead goes in here --> … some-title

, defines parameters for templates parameters can be passed to templates from either call-template or apply-template elements containing elements name attribute names the parameter select attribute (or content) defines the value of the parameter

XSLT processing flow reference to template and parameter passed return to XSLT processing flow

150 …

allows values to be stored to assist with processing flow logic name attribute names the variable select attribute (or content) defines the value of the variable value can also be defined from element content

, $y = 13 else $y = 15 -->

appears inside or inside sorts a node-set according to some criterion successive sort elements impose sub-orders select attribute defines the sorting criterion data-type defines the type of sort –text (the default) –number

more sort attributes order –ascending (default) –descending case-order –upper-first –lower-first

document ( ) converts a parameter into a URI –relative to current document –second parameter gives an alternative base URI returns a node-set associated with the URI allows content to be extracted from multiple XML documents without parameter defaults to current document

multiple XML files XSLT document XSLT processor output document set of template rules match elements and replace using template rules XML source XML source XML source XML source XML source XML source master document document()

Fridge Contents XML XSLT

XSLT extensions extension elements are passed to external code (extension functions) for processing –Java, Perl, C# etc. extends power of XSLT to arbitrary transformations implementation varies between XSLT processors –Xalan, Saxon, XT all allow extensions, but in different ways