SlideShare a Scribd company logo
  XML/XSLT Aravinda.J
Contents Introduction to XML XML in web application Java Parsers  XSLT XSLT:FO Examples Usage of XML,XSLT,XSLT:FO in EDI
XML What is XML? XML stands for E X tensible  M arkup  L anguage  XML is a  markup language  much like HTML  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  XML was designed to store, carry, and exchange data. XML was not designed to display data.
The main difference between  XML and HTML XML is not a replacement for HTML. XML and HTML were designed with different goals: XML was designed to describe data and to focus on what data is. HTML was designed to display data and to focus on how data looks.
The following example is a note to Tove from Jani, stored as XML: <?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?>  <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>
How can XML be Used? It is important to understand that XML was designed to store, carry, and exchange data. XML was not designed to display data. With XML, your data is stored outside your HTML. With XML, data can be exchanged between incompatible systems.
XML and B2B With XML, financial information can be exchanged over the Internet. XML can be used to Share Data XML can be used to Store Data XML is the mother of WAP and WML. The Wireless Markup Language (WML), used to markup Internet applications for handheld devices like mobile phones, is written in XML.
XML Syntax The syntax rules of XML are very simple and very strict. The rules are very easy to learn, and very easy to use. The first line in the document - the XML declaration - defines the XML version and the character encoding used in the document. In this case the document conforms to the 1.0 specification of XML and uses the ISO-8859-1 (Latin-1/West European) character set.  The next line describes the root element of the document (like it was saying: &quot;this document is a note&quot;):
XML SYNTAX All XML elements must have a closing tag XML tags are case sensitive All XML elements must be properly nested All XML documents must have a root element Attribute values must always be quoted
DISPLAYING XML CONTENT THROUGH XSL/JAVA/CSS XSL stands for e X tensible  S tylesheet  L anguage. The World Wide Web Consortium (W3C) started to develop XSL because there was a need for an XML based Stylesheet Language.  XML does not use predefined tags (we can use any tags we like) and the meanings of these tags are  not well understood . The <table> could mean an HTML table or a piece of furniture, and a browser  does not know how to display it . There must be something in addition to the XML document that describes how the document should be displayed; and that is XSL!
XSLT Demonstration XML Doc XML Processor (xsltproc) XSLT Stylesheet PDF XML HTML
XSL - More Than a Style Sheet Language XSLT is a language for transforming XML documents  Think of XSL as a set of languages that can  transform  XML into XHTML,  filter and sort  XML data,  define parts  of an XML document,  format  XML data based on the data value, like displaying negative numbers in red, and  output  XML data to different media, like screens, paper, or voice.  XPath is a language for defining parts of an XML document  XSL-FO is a language for formatting XML documents
WORKING OF XSLT XSLT Uses XPath XSLT uses XPath to define the matching patterns for transformations. If you want to study XPath first, please read our  XPath Tutorial . How does it Work? In the transformation process, XSLT uses XPath to define parts of the source document that  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. The parts of the source document that do not match a template will end up unmodified in the result document.
Examples: cdcatalog.xml cdcatalog.xsl
Elements in XSLT apply-imports   apply-templates   call-template   choose   decimal-format   for-each   if   otherwise   value-of
Inherited XPath Functions   count()  –Returns the no of nodes substring()  -------- substring(string,start,length)  name()   Position()   Concat()   contains()   Starts-with()   String()   String-length()
Processing of XML through Java Rerquirements Set classpath to Xalan.jar/Xerces.jar parser. Import javax.xml.transform.*; Import javax.xml.parsers.*; Import org.w3c.dom.traversal.*; import org.w3c.dom.*;
Processing ways DOM  A DOM parser reads an entire document. It then makes the tree for the entire document available to program code for reading and updating  SAX   Reading a document one piece at a time. It process the document on event based.
XML Transformation JAXP support transformation of xml and xslt in to a response tree.
Using CSS: Cascading Style Sheet (CSS) is a relatively simple tool that allows the developer to assign styles to HTML elements. CSS duplicates formatting built into HTML. It provides web developers with access to a large variety of formatting properties such as margins, line-height, word spacing and much more. CSS is easy to learn and style sheets can be included directly in xml documents or can be saved as standalone text files.
Using CSS <LINK HREF=”MyStylesheet.css” REL=”stylesheet” type=”text/css”> cd{ display: block; font-size:24pt; padding:20pt; font-wieght: bold; color: blue; Text-align: center; }
title{ display:inline; font-size:14pt; padding:20pt; font-weight:bold; color:red; } artist{ display:block; text-align:center; font-size:14pt; padding:20pt; font-weight:bold; color:green; }
XSL:FO Introduction XSL-FO is an XML based markup language describing the formatting of XML data for output to screen, paper or other media. XSL-FO stands for Extensible Stylesheet Language Formatting Objects  XSL-FO is a W3C Recommendation
XSL-FO Documents XSL-FO documents are XML files with output information. They contain information about the output layout and output contents. XSL-FO documents are stored in files with a *.fo or a *.fob extension. It is also quite normal to see XSL-FO documents stored with the *.xml extension, because this makes them more accessible to XML editors.
Structure of XSL:FO <?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?> <fo:root xmlns:fo=&quot;http://www.w3.org/1999/XSL/Format&quot;><fo:layout-master-set>  <fo:simple-page-master master-name=&quot;A4&quot;> <!-- Page template goes here -->  </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference=&quot;A4&quot;>  <!-- Page content goes here --></fo:page-sequence> </fo:root>
Examples: Invoice.xml invoice.xsl Invoice.fo
THANK YOU ..

More Related Content

PPTX
FTP & TFTP
PPT
Unix Security
PDF
Lecture 8 Library classes
PDF
Normalization in Database
PPT
Tema 2 Arquitectura De Redes
PPTX
Transaction Processing Concept
PPTX
Arp,rarp
PPTX
Internetworking
FTP & TFTP
Unix Security
Lecture 8 Library classes
Normalization in Database
Tema 2 Arquitectura De Redes
Transaction Processing Concept
Arp,rarp
Internetworking

What's hot (20)

PPTX
Introduction to php
PPTX
Architecture of dbms(lecture 3)
PPTX
PPP (Point to Point Protocol)
PPTX
Logical database design and the relational model(database)
PDF
5. Basic Structure of SQL Queries.pdf
PDF
Normalization in DBMS
PPTX
Token Ring : 802.5
PPTX
Computer architecture multi processor
PPTX
SQL Data types and Constarints.pptx
PPT
Cookies and sessions
PDF
Inside the Mac OS X Kernel
PPTX
Distributed Shared Memory
PDF
Operating System-Process Scheduling
PPTX
Ethernet and token ring
PPTX
Distributed Query Processing
PPT
Chapter07 database system in computer.ppt
PPSX
Token ring
PPTX
Osi reference model
PPT
Design issues for the layers
PPT
Mk ppt chapter 5
Introduction to php
Architecture of dbms(lecture 3)
PPP (Point to Point Protocol)
Logical database design and the relational model(database)
5. Basic Structure of SQL Queries.pdf
Normalization in DBMS
Token Ring : 802.5
Computer architecture multi processor
SQL Data types and Constarints.pptx
Cookies and sessions
Inside the Mac OS X Kernel
Distributed Shared Memory
Operating System-Process Scheduling
Ethernet and token ring
Distributed Query Processing
Chapter07 database system in computer.ppt
Token ring
Osi reference model
Design issues for the layers
Mk ppt chapter 5
Ad

Viewers also liked (20)

PPTX
PPTX
XSLT
PPTX
An Introduction to the DOM
PPT
Document Object Model
PDF
eXtensible Markup Language APIs in Java 1.6 - Simple and efficient XML parsin...
PPT
XML and XPath details
PPTX
Xml processors
PPT
Understanding XML DOM
PPT
XML SAX PARSING
PPT
Learning XSLT
PPT
PPT
PPT
XPath - XML Path Language
PPTX
Overview of XSL, XPath and XSL-FO
PPTX
Document Object Model
PDF
XSLT and XPath - without the pain!
PPTX
Xml dom
PPT
Java XML Parsing
PPT
DOM ( Document Object Model )
XSLT
An Introduction to the DOM
Document Object Model
eXtensible Markup Language APIs in Java 1.6 - Simple and efficient XML parsin...
XML and XPath details
Xml processors
Understanding XML DOM
XML SAX PARSING
Learning XSLT
XPath - XML Path Language
Overview of XSL, XPath and XSL-FO
Document Object Model
XSLT and XPath - without the pain!
Xml dom
Java XML Parsing
DOM ( Document Object Model )
Ad

Similar to XML/XSLT (20)

PPS
eXtensible Markup Language
DOCX
Xml material
DOCX
Xml material
DOCX
Xml material
PPT
Xml description
PDF
xml2cdvcx vnbm,azsdfghjkml;sxdfcgmndxfcgvhb nmfctgvbhjnm ,cfgvb nm,xc vb.pdf
PPTX
BITM3730 10-31.pptx
PPTX
BITM3730 10-18.pptx
DOCX
Introduction to xml
PPT
Xml iet 2015
PPT
PPT
01 Xml Begin
DOCX
Xml 150323102007-conversion-gate01
PPTX
BITM3730Week5.pptx
PPT
Xml and Co.
DOCX
PDF
light_xml
PPT
eXtensible Markup Language
Xml material
Xml material
Xml material
Xml description
xml2cdvcx vnbm,azsdfghjkml;sxdfcgmndxfcgvhb nmfctgvbhjnm ,cfgvb nm,xc vb.pdf
BITM3730 10-31.pptx
BITM3730 10-18.pptx
Introduction to xml
Xml iet 2015
01 Xml Begin
Xml 150323102007-conversion-gate01
BITM3730Week5.pptx
Xml and Co.
light_xml

More from thinkahead.net (13)

PPT
Catalog maintenance and epo services at ta
PPT
Think ahead presentation on bpo 2010
PPT
Entrepreneur 2b or not 2 b indo german
PPT
Formulating web and social media marketing strategy for india
PPT
Smart Card Technology
PPT
Microsoft Silverlight
PPT
Do I really need Iinternet Marketing Budget ?
PPT
Catalogue Maintenance & Editorial Process Outsourcing
PPT
CLOUD COMPUTING
PPT
Blu-ray Disc
PPT
PPT
Ruby on Rails
PPT
Firewall
Catalog maintenance and epo services at ta
Think ahead presentation on bpo 2010
Entrepreneur 2b or not 2 b indo german
Formulating web and social media marketing strategy for india
Smart Card Technology
Microsoft Silverlight
Do I really need Iinternet Marketing Budget ?
Catalogue Maintenance & Editorial Process Outsourcing
CLOUD COMPUTING
Blu-ray Disc
Ruby on Rails
Firewall

Recently uploaded (20)

PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Spectroscopy.pptx food analysis technology
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Approach and Philosophy of On baking technology
PPTX
Big Data Technologies - Introduction.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Programs and apps: productivity, graphics, security and other tools
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Spectral efficient network and resource selection model in 5G networks
Mobile App Security Testing_ A Comprehensive Guide.pdf
Spectroscopy.pptx food analysis technology
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Approach and Philosophy of On baking technology
Big Data Technologies - Introduction.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...

XML/XSLT

  • 1. XML/XSLT Aravinda.J
  • 2. Contents Introduction to XML XML in web application Java Parsers XSLT XSLT:FO Examples Usage of XML,XSLT,XSLT:FO in EDI
  • 3. XML What is XML? XML stands for E X tensible M arkup L anguage XML is a markup language much like HTML 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 XML was designed to store, carry, and exchange data. XML was not designed to display data.
  • 4. The main difference between XML and HTML XML is not a replacement for HTML. XML and HTML were designed with different goals: XML was designed to describe data and to focus on what data is. HTML was designed to display data and to focus on how data looks.
  • 5. The following example is a note to Tove from Jani, stored as XML: <?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>
  • 6. How can XML be Used? It is important to understand that XML was designed to store, carry, and exchange data. XML was not designed to display data. With XML, your data is stored outside your HTML. With XML, data can be exchanged between incompatible systems.
  • 7. XML and B2B With XML, financial information can be exchanged over the Internet. XML can be used to Share Data XML can be used to Store Data XML is the mother of WAP and WML. The Wireless Markup Language (WML), used to markup Internet applications for handheld devices like mobile phones, is written in XML.
  • 8. XML Syntax The syntax rules of XML are very simple and very strict. The rules are very easy to learn, and very easy to use. The first line in the document - the XML declaration - defines the XML version and the character encoding used in the document. In this case the document conforms to the 1.0 specification of XML and uses the ISO-8859-1 (Latin-1/West European) character set. The next line describes the root element of the document (like it was saying: &quot;this document is a note&quot;):
  • 9. XML SYNTAX All XML elements must have a closing tag XML tags are case sensitive All XML elements must be properly nested All XML documents must have a root element Attribute values must always be quoted
  • 10. DISPLAYING XML CONTENT THROUGH XSL/JAVA/CSS XSL stands for e X tensible S tylesheet L anguage. The World Wide Web Consortium (W3C) started to develop XSL because there was a need for an XML based Stylesheet Language. XML does not use predefined tags (we can use any tags we like) and the meanings of these tags are not well understood . The <table> could mean an HTML table or a piece of furniture, and a browser does not know how to display it . There must be something in addition to the XML document that describes how the document should be displayed; and that is XSL!
  • 11. XSLT Demonstration XML Doc XML Processor (xsltproc) XSLT Stylesheet PDF XML HTML
  • 12. XSL - More Than a Style Sheet Language XSLT is a language for transforming XML documents Think of XSL as a set of languages that can transform XML into XHTML, filter and sort XML data, define parts of an XML document, format XML data based on the data value, like displaying negative numbers in red, and output XML data to different media, like screens, paper, or voice.  XPath is a language for defining parts of an XML document XSL-FO is a language for formatting XML documents
  • 13. WORKING OF XSLT XSLT Uses XPath XSLT uses XPath to define the matching patterns for transformations. If you want to study XPath first, please read our XPath Tutorial . How does it Work? In the transformation process, XSLT uses XPath to define parts of the source document that 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. The parts of the source document that do not match a template will end up unmodified in the result document.
  • 15. Elements in XSLT apply-imports apply-templates call-template choose decimal-format for-each if otherwise value-of
  • 16. Inherited XPath Functions count() –Returns the no of nodes substring() -------- substring(string,start,length) name() Position() Concat() contains() Starts-with() String() String-length()
  • 17. Processing of XML through Java Rerquirements Set classpath to Xalan.jar/Xerces.jar parser. Import javax.xml.transform.*; Import javax.xml.parsers.*; Import org.w3c.dom.traversal.*; import org.w3c.dom.*;
  • 18. Processing ways DOM  A DOM parser reads an entire document. It then makes the tree for the entire document available to program code for reading and updating SAX  Reading a document one piece at a time. It process the document on event based.
  • 19. XML Transformation JAXP support transformation of xml and xslt in to a response tree.
  • 20. Using CSS: Cascading Style Sheet (CSS) is a relatively simple tool that allows the developer to assign styles to HTML elements. CSS duplicates formatting built into HTML. It provides web developers with access to a large variety of formatting properties such as margins, line-height, word spacing and much more. CSS is easy to learn and style sheets can be included directly in xml documents or can be saved as standalone text files.
  • 21. Using CSS <LINK HREF=”MyStylesheet.css” REL=”stylesheet” type=”text/css”> cd{ display: block; font-size:24pt; padding:20pt; font-wieght: bold; color: blue; Text-align: center; }
  • 22. title{ display:inline; font-size:14pt; padding:20pt; font-weight:bold; color:red; } artist{ display:block; text-align:center; font-size:14pt; padding:20pt; font-weight:bold; color:green; }
  • 23. XSL:FO Introduction XSL-FO is an XML based markup language describing the formatting of XML data for output to screen, paper or other media. XSL-FO stands for Extensible Stylesheet Language Formatting Objects XSL-FO is a W3C Recommendation
  • 24. XSL-FO Documents XSL-FO documents are XML files with output information. They contain information about the output layout and output contents. XSL-FO documents are stored in files with a *.fo or a *.fob extension. It is also quite normal to see XSL-FO documents stored with the *.xml extension, because this makes them more accessible to XML editors.
  • 25. Structure of XSL:FO <?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?> <fo:root xmlns:fo=&quot;http://www.w3.org/1999/XSL/Format&quot;><fo:layout-master-set> <fo:simple-page-master master-name=&quot;A4&quot;> <!-- Page template goes here --> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference=&quot;A4&quot;> <!-- Page content goes here --></fo:page-sequence> </fo:root>