SlideShare une entreprise Scribd logo
1  sur  27
Transforming XML Document 
by: Vijay Kumar Verma (VJY)
Objective 
What is XSL? 
What is XSLT? 
XSLT Elements 
Example
α Extensible Stylesheet Language. 
α A Formatting language. 
α Vocabulary for describing the formatting 
(i.e. layout) What of a document is XSL? 
via "Formatting 
Objects“ 
α Consist of Three part 
 XSLT 
 Xpath 
 XSL-FO
XML 
(content) 
XSL 
(presentation) 
How it Works? 
XSL Parser 
(Transformation engine) 
XML, PDF, XHTML
α Here’s a simple XML document: 
<?xml version="1.0"?> 
<library> 
Simple Xpath 
<book> 
<title edition=“2”>XML</title> 
<author>Gregory Brill</author> 
</book> 
<book> 
<title edition=“1”>Java and 
XML</title> 
<author>Brett McLaughlin</author> 
</book> 
</library > 
Xpath Expressions 
/library 
/library/book 
/library/book/title 
/library/book/title/@edition 
/library/book/title/[@edition=2] 
/library/book[1] 
//book[2] 
/library/* 
/library/book[1]/title/text()
Simple Xpath 
α Here’s a simple XML document: 
<?xml version="1.0"?> 
<library> 
<book> 
<title edition=“2”>XML</title> 
<author>Gregory Brill</author> 
</book> 
<book> 
<title edition=“1”>Java and 
XML</title> 
<author>Brett McLaughlin</author> 
</book> 
</library > 
Xpath Expressions 
/library 
/library/book 
/library/book/title 
/library/book/title/@edition 
/library/book/title/[@edition=2] 
/library/book[1] 
//book[2] 
/library/* 
/library/book[1]/title/text()
α Here’s a simple XML document: 
<?xml version="1.0"?> 
<library> 
<book> 
<title edition=“2”>XML</title> 
<author>Gregory Brill</author> 
</book> 
<book> 
<title edition=“1”>Java and 
XML</title> 
<author>Brett McLaughlin</author> 
</book> 
</library > 
Xpath Expressions 
/library 
/library/book 
/library/book/title 
/library/book/title/@edition 
/library/book/title/[@edition=2] 
/library/book[1] 
//book[2] 
/library/* 
/library/book[1]/title/text() 
Simple Xpath
α Here’s a simple XML document: 
<?xml version="1.0"?> 
<library> 
<book> 
<title edition=“2”>XML</title> 
<author>Gregory Brill</author> 
</book> 
<book> 
<title edition=“1”>Java and 
XML</title> 
<author>Brett McLaughlin</author> 
</book> 
</library > 
Xpath Expressions 
/library 
/library/book 
/library/book/title 
/library/book/title/@edition 
/library/book/title/[@edition=2] 
/library/book[1] 
//book[2] 
/library/* 
/library/book[1]/title/text() 
Simple Xpath
α Here’s a simple XML document: 
<?xml version="1.0"?> 
<library> 
<book> 
<title edition=“2”>XML</title> 
<author>Gregory Brill</author> 
</book> 
<book> 
<title edition=“1”>Java and 
XML</title> 
<author>Brett McLaughlin</author> 
</book> 
</library > 
Xpath Expressions 
/library 
/library/book 
/library/book/title 
/library/book/title/@edition 
/library/book/title/[@edition=2] 
/library/book[1] 
//book[2] 
/library/* 
predicate 
/library/book[1]/title/text() 
Simple Xpath
α Here’s a simple XML document: 
<?xml version="1.0"?> 
<library> 
<book> 
<title edition=“2”>XML</title> 
<author>Gregory Brill</author> 
</book> 
<book> 
<title edition=“1”>Java and 
XML</title> 
<author>Brett McLaughlin</author> 
</book> 
</library > 
Xpath Expressions 
/library 
/library/book 
/library/book/title 
/library/book/title/@edition 
/library/book/title/[@edition=2] 
/library/book[1] 
//book[2] 
/library/* 
/library/book[1]/title/text() 
Simple Xpath
α Here’s a simple XML document: 
<?xml version="1.0"?> 
<library> 
<book> 
<title edition=“2”>XML</title> 
<author>Gregory Brill</author> 
</book> 
<book> 
<title edition=“1”>Java and 
XML</title> 
<author>Brett McLaughlin</author> 
</book> 
</library > 
Xpath Expressions 
/library 
/library/book 
/library/book/title 
/library/book/title/@edition 
/library/book/title/[@edition=2] 
/library/book[1] 
//book[2] 
/library/* 
/library/book[1]/title/text() 
Simple Xpath
α Here’s a simple XML document: 
<?xml version="1.0"?> 
<library> 
<book> 
<title edition=“2”>XML</title> 
<author>Gregory Brill</author> 
</book> 
<book> 
<title edition=“1”>Java and 
XML</title> 
<author>Brett McLaughlin</author> 
</book> 
</library > 
Xpath Expressions 
/library 
/library/book 
/library/book/title 
/library/book/title/@edition 
/library/book/title/[@edition=2] 
/library/book[1] 
//book[2] 
/library/* 
/library/book[1]/title/text() 
Simple Xpath
α Here’s a simple XML document: 
<?xml version="1.0"?> 
<library> 
<book> 
<title edition=“2”>XML</title> 
<author>Gregory Brill</author> 
</book> 
<book> 
<title edition=“1”>Java and 
XML</title> 
<author>Brett McLaughlin</author> 
</book> 
</library > 
Xpath Expressions 
/library 
/library/book 
/library/book/title 
/library/book/title/@edition 
/library/book/title/[@edition=2] 
/library/book[1] 
//book[2] 
/library/* 
/library/book[1]/title/text() 
Simple Xpath
α Extensible Stylesheet Language 
Transformations 
α XSLT1.0 accepted in 1999 as W3C standard 
α XSLT2.0 just reached recommendation level 
What is XSLT? 
in January 2007. 
α XSLT is designed for use as part of XSL, 
which is a stylesheet language for XML. 
α Use XML Syntax. 
α Can be used like a stylesheet or embedded 
in a programming language.
<xsl:stylesheet version=“1.0” 
xmlns:xsl=“http://www.w3.org/1999/XSL/Transform”> 
<xsl:import/> 
<xsl:include/> 
<xsl:strip-space/> 
<xsl:preserve-space/> 
<xsl:output/> 
<xsl:key/> 
<xsl:decimal-format/> 
<xsl:namespace-alias/> 
<xsl:attribute-set>...</xsl:attribute-set> 
<xsl:variable>...</xsl:variable> 
<xsl:param>...</xsl:param> 
<xsl:template match=“...”> 
Syntax and structure 
... 
</xsl:template> 
<xsl:template name=“...”> 
... 
</xsl:template 
</xsl:stylesheet>
Example
α Text Editor (Notepad++) 
α Web browser 
α Mind  
Requirement
<?xml version='1.0' encoding='utf-8'?> 
<?xml-stylesheet href=bird.xsl" type="text/xsl"?> 
<zoo> 
XML File 
<bird> 
<name>Peacock</name> 
<size>Large</size> 
</bird> 
<bird> 
<name>Sparrow</name> 
<size>Small</size> 
</bird> 
<bird> 
<name>peagion</name> 
<size>medium</size> 
</bird> 
</zoo>
<?xml version='1.0'?> 
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
<xsl:template match="/"> 
<html> 
XSL File 
<head> 
<title>Bird in Zoo</title> 
</head> 
<body> 
<xsl:for-each select="zoo/bird"> 
<ol> 
<li><xsl:value-of select="name"/></li> 
<li><xsl:value-of select="size"/></li> 
</ol> 
</xsl:for-each> 
</body> 
</html> 
</xsl:template> 
</xsl:stylesheet>
Output 
Without XSL After Using XSL
 <xsl:for-each select="//book"> 
loops through every book element, everywhere in the 
document 
 <xsl:value-of select="title"/> 
chooses the content of the title element at the 
current location 
Summary of XSL file 
 <xsl:for-each select="//book"> 
<xsl:value-of select="title"/> 
</xsl:for-each> 
chooses the content of the title element for each 
book in the XML document
<?xml version='1.0'?> 
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
<xsl:template match="//bird"> 
<html> 
<head> 
<title>Bird in Zoo</title> 
</head> 
<body> 
Another XSL File 
<xsl:if test="name='peagion'"> 
<h1>Size of peagion: <xsl:value-of select="size" 
/></h1> 
</xsl:if> 
</body> 
</html> 
</xsl:template> 
</xsl:stylesheet>
Output 
Without XSL
<?xml version='1.0'?> 
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
<xsl:template match="//bird"> 
<html> 
<head> 
<title>Bird in Zoo</title> 
</head> 
<body> 
Choose, when, <xsl:choose> 
otherwise 
<xsl:when test="name='peagion'"> 
<h1>Symbol of peace.</h1> 
</xsl:when> 
<xsl:when test="name='Peacock'"> 
<h1>National Bird</h1> 
</xsl:when> 
<xsl:otherwise> 
<h1>Simple Bird</h1> 
</xsl:otherwise> 
</xsl:choose> 
</body></html></xsl:template></xsl:stylesheet>
Output
XML XSLT
XML XSLT

Contenu connexe

Tendances (20)

Introduction to XSLT
Introduction to XSLTIntroduction to XSLT
Introduction to XSLT
 
5 xsl (formatting xml documents)
5   xsl (formatting xml documents)5   xsl (formatting xml documents)
5 xsl (formatting xml documents)
 
XSLT
XSLTXSLT
XSLT
 
XSLT presentation
XSLT presentationXSLT presentation
XSLT presentation
 
Querring xml with xpath
Querring xml with xpath Querring xml with xpath
Querring xml with xpath
 
XSLT
XSLTXSLT
XSLT
 
Learning XSLT
Learning XSLTLearning XSLT
Learning XSLT
 
XSLT and XPath - without the pain!
XSLT and XPath - without the pain!XSLT and XPath - without the pain!
XSLT and XPath - without the pain!
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Displaying XML Documents Using CSS and XSL
Displaying XML Documents Using CSS and XSLDisplaying XML Documents Using CSS and XSL
Displaying XML Documents Using CSS and XSL
 
Xml Lecture Notes
Xml Lecture NotesXml Lecture Notes
Xml Lecture Notes
 
Xslt
XsltXslt
Xslt
 
Xml p5 Lecture Notes
Xml p5 Lecture NotesXml p5 Lecture Notes
Xml p5 Lecture Notes
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Xml 215-presentation
Xml 215-presentationXml 215-presentation
Xml 215-presentation
 
C:\fakepath\xsl final
C:\fakepath\xsl finalC:\fakepath\xsl final
C:\fakepath\xsl final
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Xml
XmlXml
Xml
 
Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to xml
 
XML, DTD & XSD Overview
XML, DTD & XSD OverviewXML, DTD & XSD Overview
XML, DTD & XSD Overview
 

En vedette

XSLT 2010-03-03
XSLT 2010-03-03XSLT 2010-03-03
XSLT 2010-03-03kmiyako
 
Introductionto xslt
Introductionto xsltIntroductionto xslt
Introductionto xsltKumar
 
Introduction to XSLT SPSBE07
Introduction to XSLT SPSBE07Introduction to XSLT SPSBE07
Introduction to XSLT SPSBE07Elio Struyf
 
Integrative Programming and Technology Chapter 4- Dr. J. VijiPriya
Integrative Programming and Technology Chapter 4- Dr. J. VijiPriyaIntegrative Programming and Technology Chapter 4- Dr. J. VijiPriya
Integrative Programming and Technology Chapter 4- Dr. J. VijiPriyaVijiPriya Jeyamani
 
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FOOverview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FOSuite Solutions
 

En vedette (9)

XSLT 2010-03-03
XSLT 2010-03-03XSLT 2010-03-03
XSLT 2010-03-03
 
Xslt
XsltXslt
Xslt
 
4 xslt
4   xslt4   xslt
4 xslt
 
XSLT for Web Developers
XSLT for Web DevelopersXSLT for Web Developers
XSLT for Web Developers
 
Xslt
XsltXslt
Xslt
 
Introductionto xslt
Introductionto xsltIntroductionto xslt
Introductionto xslt
 
Introduction to XSLT SPSBE07
Introduction to XSLT SPSBE07Introduction to XSLT SPSBE07
Introduction to XSLT SPSBE07
 
Integrative Programming and Technology Chapter 4- Dr. J. VijiPriya
Integrative Programming and Technology Chapter 4- Dr. J. VijiPriyaIntegrative Programming and Technology Chapter 4- Dr. J. VijiPriya
Integrative Programming and Technology Chapter 4- Dr. J. VijiPriya
 
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FOOverview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
 

Similaire à XML XSLT

The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld
The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld
The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld BookNet Canada
 
Xml nisha dwivedi
Xml nisha dwivediXml nisha dwivedi
Xml nisha dwivediNIIT
 
Xml transformation language
Xml transformation languageXml transformation language
Xml transformation languagereshmavasudev
 
Service Oriented Architecture - Unit II
Service Oriented Architecture - Unit IIService Oriented Architecture - Unit II
Service Oriented Architecture - Unit IIRoselin Mary S
 
"Getting Started with XSLT" presentation slides
"Getting Started with XSLT" presentation slides"Getting Started with XSLT" presentation slides
"Getting Started with XSLT" presentation slidesRussell Ward
 
Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...
Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...
Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...Allison Jai O'Dell
 
Introduction of xml and xslt
Introduction of xml and xsltIntroduction of xml and xslt
Introduction of xml and xsltTUSHAR VARSHNEY
 
eXtensible Markup Language (XML)
eXtensible Markup Language (XML)eXtensible Markup Language (XML)
eXtensible Markup Language (XML)Serhii Kartashov
 
XSLT 3 for EPUB and Print - Liam R.E. Quin (Barefoot Computing) - ebookcraft ...
XSLT 3 for EPUB and Print - Liam R.E. Quin (Barefoot Computing) - ebookcraft ...XSLT 3 for EPUB and Print - Liam R.E. Quin (Barefoot Computing) - ebookcraft ...
XSLT 3 for EPUB and Print - Liam R.E. Quin (Barefoot Computing) - ebookcraft ...BookNet Canada
 
IWMW 2001: XML and XSLT
IWMW 2001: XML and XSLT IWMW 2001: XML and XSLT
IWMW 2001: XML and XSLT IWMW
 
Extensible Stylesheet Language
Extensible Stylesheet LanguageExtensible Stylesheet Language
Extensible Stylesheet LanguageJussi Pohjolainen
 

Similaire à XML XSLT (20)

The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld
The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld
The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld
 
Xml nisha dwivedi
Xml nisha dwivediXml nisha dwivedi
Xml nisha dwivedi
 
Xml 215-presentation
Xml 215-presentationXml 215-presentation
Xml 215-presentation
 
XML
XMLXML
XML
 
Xml transformation language
Xml transformation languageXml transformation language
Xml transformation language
 
Xsl xslt
Xsl  xsltXsl  xslt
Xsl xslt
 
Xslt
XsltXslt
Xslt
 
Service Oriented Architecture - Unit II
Service Oriented Architecture - Unit IIService Oriented Architecture - Unit II
Service Oriented Architecture - Unit II
 
"Getting Started with XSLT" presentation slides
"Getting Started with XSLT" presentation slides"Getting Started with XSLT" presentation slides
"Getting Started with XSLT" presentation slides
 
Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...
Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...
Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...
 
Chapter4
Chapter4Chapter4
Chapter4
 
Introduction of xml and xslt
Introduction of xml and xsltIntroduction of xml and xslt
Introduction of xml and xslt
 
XSL - XML STYLE SHEET
XSL - XML STYLE SHEETXSL - XML STYLE SHEET
XSL - XML STYLE SHEET
 
XSL- XSLT.pdf
XSL- XSLT.pdfXSL- XSLT.pdf
XSL- XSLT.pdf
 
eXtensible Markup Language (XML)
eXtensible Markup Language (XML)eXtensible Markup Language (XML)
eXtensible Markup Language (XML)
 
XPATH_XSLT-1.pptx
XPATH_XSLT-1.pptxXPATH_XSLT-1.pptx
XPATH_XSLT-1.pptx
 
Xml 2
Xml  2 Xml  2
Xml 2
 
XSLT 3 for EPUB and Print - Liam R.E. Quin (Barefoot Computing) - ebookcraft ...
XSLT 3 for EPUB and Print - Liam R.E. Quin (Barefoot Computing) - ebookcraft ...XSLT 3 for EPUB and Print - Liam R.E. Quin (Barefoot Computing) - ebookcraft ...
XSLT 3 for EPUB and Print - Liam R.E. Quin (Barefoot Computing) - ebookcraft ...
 
IWMW 2001: XML and XSLT
IWMW 2001: XML and XSLT IWMW 2001: XML and XSLT
IWMW 2001: XML and XSLT
 
Extensible Stylesheet Language
Extensible Stylesheet LanguageExtensible Stylesheet Language
Extensible Stylesheet Language
 

Plus de Vijay Kumar Verma

Plus de Vijay Kumar Verma (10)

Oo methodology
Oo methodologyOo methodology
Oo methodology
 
XML_schema_Structure
XML_schema_StructureXML_schema_Structure
XML_schema_Structure
 
Introduction to Java Script
Introduction to Java ScriptIntroduction to Java Script
Introduction to Java Script
 
Php introduction and configuration
Php introduction and configurationPhp introduction and configuration
Php introduction and configuration
 
Security threats ecom
Security threats ecomSecurity threats ecom
Security threats ecom
 
Dwm temporal measure
Dwm temporal measureDwm temporal measure
Dwm temporal measure
 
Html+css web layout 2
Html+css web layout 2Html+css web layout 2
Html+css web layout 2
 
Open gl configuration_march2014
Open gl configuration_march2014Open gl configuration_march2014
Open gl configuration_march2014
 
Aos distibutted system
Aos distibutted systemAos distibutted system
Aos distibutted system
 
Html+css web layout
Html+css web layoutHtml+css web layout
Html+css web layout
 

Dernier

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 

Dernier (20)

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 

XML XSLT

  • 1. Transforming XML Document by: Vijay Kumar Verma (VJY)
  • 2. Objective What is XSL? What is XSLT? XSLT Elements Example
  • 3. α Extensible Stylesheet Language. α A Formatting language. α Vocabulary for describing the formatting (i.e. layout) What of a document is XSL? via "Formatting Objects“ α Consist of Three part  XSLT  Xpath  XSL-FO
  • 4. XML (content) XSL (presentation) How it Works? XSL Parser (Transformation engine) XML, PDF, XHTML
  • 5. α Here’s a simple XML document: <?xml version="1.0"?> <library> Simple Xpath <book> <title edition=“2”>XML</title> <author>Gregory Brill</author> </book> <book> <title edition=“1”>Java and XML</title> <author>Brett McLaughlin</author> </book> </library > Xpath Expressions /library /library/book /library/book/title /library/book/title/@edition /library/book/title/[@edition=2] /library/book[1] //book[2] /library/* /library/book[1]/title/text()
  • 6. Simple Xpath α Here’s a simple XML document: <?xml version="1.0"?> <library> <book> <title edition=“2”>XML</title> <author>Gregory Brill</author> </book> <book> <title edition=“1”>Java and XML</title> <author>Brett McLaughlin</author> </book> </library > Xpath Expressions /library /library/book /library/book/title /library/book/title/@edition /library/book/title/[@edition=2] /library/book[1] //book[2] /library/* /library/book[1]/title/text()
  • 7. α Here’s a simple XML document: <?xml version="1.0"?> <library> <book> <title edition=“2”>XML</title> <author>Gregory Brill</author> </book> <book> <title edition=“1”>Java and XML</title> <author>Brett McLaughlin</author> </book> </library > Xpath Expressions /library /library/book /library/book/title /library/book/title/@edition /library/book/title/[@edition=2] /library/book[1] //book[2] /library/* /library/book[1]/title/text() Simple Xpath
  • 8. α Here’s a simple XML document: <?xml version="1.0"?> <library> <book> <title edition=“2”>XML</title> <author>Gregory Brill</author> </book> <book> <title edition=“1”>Java and XML</title> <author>Brett McLaughlin</author> </book> </library > Xpath Expressions /library /library/book /library/book/title /library/book/title/@edition /library/book/title/[@edition=2] /library/book[1] //book[2] /library/* /library/book[1]/title/text() Simple Xpath
  • 9. α Here’s a simple XML document: <?xml version="1.0"?> <library> <book> <title edition=“2”>XML</title> <author>Gregory Brill</author> </book> <book> <title edition=“1”>Java and XML</title> <author>Brett McLaughlin</author> </book> </library > Xpath Expressions /library /library/book /library/book/title /library/book/title/@edition /library/book/title/[@edition=2] /library/book[1] //book[2] /library/* predicate /library/book[1]/title/text() Simple Xpath
  • 10. α Here’s a simple XML document: <?xml version="1.0"?> <library> <book> <title edition=“2”>XML</title> <author>Gregory Brill</author> </book> <book> <title edition=“1”>Java and XML</title> <author>Brett McLaughlin</author> </book> </library > Xpath Expressions /library /library/book /library/book/title /library/book/title/@edition /library/book/title/[@edition=2] /library/book[1] //book[2] /library/* /library/book[1]/title/text() Simple Xpath
  • 11. α Here’s a simple XML document: <?xml version="1.0"?> <library> <book> <title edition=“2”>XML</title> <author>Gregory Brill</author> </book> <book> <title edition=“1”>Java and XML</title> <author>Brett McLaughlin</author> </book> </library > Xpath Expressions /library /library/book /library/book/title /library/book/title/@edition /library/book/title/[@edition=2] /library/book[1] //book[2] /library/* /library/book[1]/title/text() Simple Xpath
  • 12. α Here’s a simple XML document: <?xml version="1.0"?> <library> <book> <title edition=“2”>XML</title> <author>Gregory Brill</author> </book> <book> <title edition=“1”>Java and XML</title> <author>Brett McLaughlin</author> </book> </library > Xpath Expressions /library /library/book /library/book/title /library/book/title/@edition /library/book/title/[@edition=2] /library/book[1] //book[2] /library/* /library/book[1]/title/text() Simple Xpath
  • 13. α Here’s a simple XML document: <?xml version="1.0"?> <library> <book> <title edition=“2”>XML</title> <author>Gregory Brill</author> </book> <book> <title edition=“1”>Java and XML</title> <author>Brett McLaughlin</author> </book> </library > Xpath Expressions /library /library/book /library/book/title /library/book/title/@edition /library/book/title/[@edition=2] /library/book[1] //book[2] /library/* /library/book[1]/title/text() Simple Xpath
  • 14. α Extensible Stylesheet Language Transformations α XSLT1.0 accepted in 1999 as W3C standard α XSLT2.0 just reached recommendation level What is XSLT? in January 2007. α XSLT is designed for use as part of XSL, which is a stylesheet language for XML. α Use XML Syntax. α Can be used like a stylesheet or embedded in a programming language.
  • 15. <xsl:stylesheet version=“1.0” xmlns:xsl=“http://www.w3.org/1999/XSL/Transform”> <xsl:import/> <xsl:include/> <xsl:strip-space/> <xsl:preserve-space/> <xsl:output/> <xsl:key/> <xsl:decimal-format/> <xsl:namespace-alias/> <xsl:attribute-set>...</xsl:attribute-set> <xsl:variable>...</xsl:variable> <xsl:param>...</xsl:param> <xsl:template match=“...”> Syntax and structure ... </xsl:template> <xsl:template name=“...”> ... </xsl:template </xsl:stylesheet>
  • 17. α Text Editor (Notepad++) α Web browser α Mind  Requirement
  • 18. <?xml version='1.0' encoding='utf-8'?> <?xml-stylesheet href=bird.xsl" type="text/xsl"?> <zoo> XML File <bird> <name>Peacock</name> <size>Large</size> </bird> <bird> <name>Sparrow</name> <size>Small</size> </bird> <bird> <name>peagion</name> <size>medium</size> </bird> </zoo>
  • 19. <?xml version='1.0'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> XSL File <head> <title>Bird in Zoo</title> </head> <body> <xsl:for-each select="zoo/bird"> <ol> <li><xsl:value-of select="name"/></li> <li><xsl:value-of select="size"/></li> </ol> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet>
  • 20. Output Without XSL After Using XSL
  • 21.  <xsl:for-each select="//book"> loops through every book element, everywhere in the document  <xsl:value-of select="title"/> chooses the content of the title element at the current location Summary of XSL file  <xsl:for-each select="//book"> <xsl:value-of select="title"/> </xsl:for-each> chooses the content of the title element for each book in the XML document
  • 22. <?xml version='1.0'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="//bird"> <html> <head> <title>Bird in Zoo</title> </head> <body> Another XSL File <xsl:if test="name='peagion'"> <h1>Size of peagion: <xsl:value-of select="size" /></h1> </xsl:if> </body> </html> </xsl:template> </xsl:stylesheet>
  • 24. <?xml version='1.0'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="//bird"> <html> <head> <title>Bird in Zoo</title> </head> <body> Choose, when, <xsl:choose> otherwise <xsl:when test="name='peagion'"> <h1>Symbol of peace.</h1> </xsl:when> <xsl:when test="name='Peacock'"> <h1>National Bird</h1> </xsl:when> <xsl:otherwise> <h1>Simple Bird</h1> </xsl:otherwise> </xsl:choose> </body></html></xsl:template></xsl:stylesheet>