Introduction to XSL Hudson Ummem Veloso (huv) Luciano de Moura Silva (lms4)

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. Branching in XSLT XSLT is functional programming –The program evaluates a function –The function transforms one structure into another.
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.
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.
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]
XSLT & XPATH. From Friday Everything in XML is machine readable Attributes describe elements, so does an element’s place in the tree (context) XML must.
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)
Week 0534Styling XML1 Topics CSS – styling XML for screen presentation –Associating CSS with XML –Selectors –Element positioning –Element appearance XSL.
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.
Chapter 12 Creating and Using XML Documents HTML5 AND CSS Seventh Edition.
Sheet 1XML Technology in E-Commerce 2001Lecture 6 XML Technology in E-Commerce Lecture 6 XPointer, XSLT.
CIS 375—Web App Dev II XSLFO. 2 XSLFO IntroductionIntroduction XSLFO stands for Extensible Stylesheet Language ___________________. XSLFO is an _____-based.
Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials.
CSE3201/CSE4500 XPath. 2 XPath A locator for elements or attributes in an XML document. XPath expression gives direction.
IS432 Semi-Structured Data Lecture 5: XSLT Dr. Gamal Al-Shorbagy.
CSE3201/CSE4500 Information Retrieval Systems
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
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
Another PillowTalk Presentation  2004 Dynamic Systems, Inc. Introduction to XML for SOA Lee H. Burstein,
Session II Chapter 2 – Chapter 2 – XSLhttp://
Sheet 1XML Technology in E-Commerce 2001Lecture 7 XML Technology in E-Commerce Lecture 7 XSL Formatting Objects, Java Data Binding.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 6 XSLT (Based on Møller and Schwartzbach,
XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML.
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.
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)
Waqas Anwar Next SlidePrevious Slide. Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language.
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.
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.
University of Nottingham School of Computer Science & Information Technology Introduction to XML 2. XSLT Tim Brailsford.
CSS Cascading Style Sheets A very brief introduction CSS, Cascading Style Sheets1.
ACG 4401 XSLT Extensible Stylesheet Language for Transformations Presenting XML and XBRL.
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.
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.
SDPL 2004Notes 4: Intro to Style Sheets1 4. Introduction to Style Sheets n Discussed recently: –Programmatic manipulation of documents n Now a more human.
SDPL 2001Notes 6: XSL1 6 XSL: Extensible Stylesheet Language n An advanced style language for XML documents: 1. Language for transforming XML documents:
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.
XSLT, XML Schema, and XPath Matt McClelland. Introduction XML Schema ▫Defines the content and structure of XML data. XSLT ▫Used to transform XML documents.
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)
XSLT: The XML transformation language
Introduction to XHTML.
ACG 4401 XSLT Extensible Stylesheet Language for Transformations
XML WITH CSS.
Presentation transcript:

Introduction to XSL Hudson Ummem Veloso (huv) Luciano de Moura Silva (lms4)

12/02/ Introduction What is XSL? –XSL stands for E X tensible S tylesheet L anguage –XSL is a style sheet language applied in archives XML But what is a Style Sheet? –A list of page format specifications, including typographic and layout specifications, that, when applied to structured information, provides a particular rendering of that information. –Different style sheets may be applied to the same piece of structured information to produce different presentations of the information.

12/02/ Introduction How XSL will be used in the BrazilIP? –Formatting of archives XML –Create the PDF files for documentation –Create the HTML files to make use in the Internet Why to use XML and XSL? –The XML validation can be automatized –The XSL is recommended for W3C for formatting the XML files –The XSL is more powerfull than CSS

12/02/ Introduction XSL components –XSLT - a language for transforming XML documents –XPath - a language for navigating in XML documents –XSL-FO - a language for formatting XML documents

12/02/ XSLT What is XSLT? –XSLT stands for XSL Transformations –XSLT transforms an XML document into another XML document –XSLT uses XPath to navigate in XML documents

12/02/ XSLT How does it works –In the transformation process, XSLT uses XPath to define parts of the source document that should match one or more predefined templates. When a match is found, XSLT will transform the matching part of the source document into the result document. Brazil IP...

12/02/ XSLT – Transformation How to create a HTML document with the following XML document? example.xml Brazil IP Fênix Configuração rgo drm 5 …

12/02/ XSLT - Transformation Create the XSL template example1.xsl (open the example.xml with browser) GroupName: NumberofMembers:

12/02/ XSLT – The element is used to extract the value of a selected node Modif link (href) in the example.xml for example2.xsl and view with browser GroupName: LeaderOne:

12/02/ XSLT - The element allows you to do looping in XSLT Modif link (href) in the example.xml for example3.xsl and view with browser GroupName: NumberofMembers:

12/02/ XSLT - The element is used to sort the output. Modif link (href) in the example.xml for example4.xsl and view with browser GroupName: NumberofMembers:

12/02/ XSLT - The element is used to put a conditional test against the content of the XML file. –Syntaxe: Where to put the element? –To add a conditional test, add the element inside the element in the XSL file:......some output if the expression is true......

12/02/ XSLT - View the example above Modif link (href) in the example.xml for example5.xsl and view with browser GroupName:

12/02/ XSLT - The element is used in conjunction with and to express multiple conditional tests. The element is used for simulation of if then else structure –Syntaxe : Where to put the Choose Condition? –To insert a conditional choose test against the content of the XML file, add the,, and elements to the XSL file:... some output some output....

12/02/ XSLT - Modif link (href) in the example.xml for example6.xsl and view with browser GroupName: GroupName:

12/02/ XSLT - The element applies a template to the current element or to the current element's child nodes. Modif link (href) in the example.xml for example7.xsl and view with browser GroupName:

12/02/ XPath and XSLT – basics functions Context functions: Modif link (href) in the example.xml for example8.xsl and view with browser GroupName: NumberofMembers:

12/02/ XPath and XSLT – basics functions Functions on Boolean values: Modif link (href) in the example.xml for example9.xsl and view with browser GroupName: NumberofMembers:

12/02/ XPath and XSLT – basics functions Arithmetic functions: –sum(node set) - this function sums up all the values in the set of nodes –floor(number) returns the largest integer that is not greater than number Example: floor(2.5) returns 2 –ceiling(number) returns the smallest integer that is not less than number Example. Ceiling(2.5) returns 3 –round(number) returns the integer closest to number Example. round(2.3) returns 2 NumberofMembers in the USB host project:

12/02/ XPath and XSLT – basics functions String functions: –string(arg) - returns the string value of the argument. The argument could be a number, boolean, or node-set Example: string(314) –Result: “314” –string-length(string) - returns the length of the specified string. Example: string-lenght(‘Brazil-IP’) –Result: 9 –concat(string,string,...) - returns the concatenation of the strings Example: concat(‘Brazil’,‘-’,’IP’,) –Result: “Brazil-IP” –translate(string1,string2,string3) – Converts string1 by replacing the characters in string2 with the characters in string3 Example: translate('12:30',‘0123',‘abcd') –Result: “bc:da”

12/02/ XPath and XSLT – basics functions Group Name Leader1 Leader2 Length String Modif link (href) in the example.xml for example11.xsl and view with browser

12/02/ XSLT - elements –The element is used to add attributes to elements. yellow Modif link (href) in the example.xml for example12.xsl and view with browser

12/02/ XSLT - elements –The element writes a message to the output. This element is primarily used to report errors This line is pair Modif link (href) in the example.xml for example13.xsl and view with browser

12/02/ XSLT XSLT Processors –Saxon ( is a free processor written in Javahttp://saxon.sourceforge.net/ –Xalan ( is part of the Apache XML Project. It has versions written in both Java and C++, both of them freehttp://xml.apache.org/xalan-j/index.html –xsltproc ( processor is written in C. It is free and is considered the fastest of the processorshttp://xmlsoft.org/XSLT/ –Microsoft's MSXML ( engine includes an XSLT processor. It is reported to be fast, but only runs on Windowshttp://msdn.microsoft.com/xml/

12/02/ XSLT How to generate a HTML file from a XML and a XSL files –First we have to get the fop.zip from Apache.orgApache.org –Then use the xalan command xalan -in inputFile.xml -out outputFile.html

12/02/ XSL-FO What is XSL-FO? –XSL-FO stands for Extensible Stylesheet Language Formatting Objects –XSL-FO is an XML-based markup language describing the formatting of XML data for output to screen, paper or other media.

12/02/ XSL-FO XSL-FO document structure

12/02/ XSL-FO XSL-FO Areas –XSL-FO uses rectangules boxes (areas) to display output Pages Regions Block areas Line areas Inline areas

12/02/ XSL-FO XSL-FO Areas –Pages contain margin-top margin-bottom margin-left margin-right Regions –Regions contain region-body region-before region-after region-start region-end Block areas

12/02/ XSL-FO

12/02/ XSL-FO XSL-FO Areas –Block Areas Block areas defines small block elements like paragraphs, tables and lists Can contain other Block areas, but most often they contain Line areas –Line Areas Define text lines inside Block areas Contain Inline areas –Inline Areas Define text inside Lines (bullets, single character, graphics)

12/02/ XSL-FO A real XSL-FO example Hello Brazil_IP

12/02/ XSL-FO Templates <fo:simple-page-master master-name="capa" page-width="297mm" page-height="210mm" margin-top="3cm" margin-bottom="3cm" margin-left="2cm" margin-right="2cm"> <fo:simple-page-master master-name="A4" page-width="297mm" page-height="210mm" margin-top="1cm" margin-bottom="1cm" margin-left="1cm" margin-right="1cm">

12/02/ XSL-FO XSL-FO Processors –XSL Formatter ( –Xinc Beta Release ( A Swing based XSL-FO viewer allows you to view and print XSL-FO files as well as generate PDF files with the click of a button. –FOP ( It is a free Java application that reads a formatting object (FO) tree and renders the resulting pages to a specified output.

12/02/ XSL-FO How to generate a PDF file from a XML and a XSL files –Use the xalan command to create the FO file –Then use the fop comand to generate the PDF xalan -in inputFile.xml -out outputFile.fo fop -fo inputFile.fo -pdf outputFile.pdf

12/02/ XSL-FO You also can generate a PS file –Use the xalan command to create the FO file –Then use the fop comand to generate the PS xalan -in inputFile.xml -out outputFile.fo fop -fo inputFile.fo -ps outputFile.ps

12/02/ Study Bibliography – This site have some tutorials about XML, HTML, CSS and XSL for beginners. – A reference guide about XSL. – A guide to generate PDF files from a XSL-FO. – A complete source with tutorials an reference guides about XML, XSLT, XSL-FO, CSS and others. – Where to download the FOP XSL-FO Processor.