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

Viewers also liked (20)

PPT
XML and XPath details
DSK Chakravarthy
 
PPTX
Xml processors
Saurav Mawandia
 
PPT
Understanding XML DOM
Om Vikram Thapa
 
PPT
XML SAX PARSING
Eviatar Levy
 
PPT
Learning XSLT
Overdue Books LLC
 
PPT
Xpath presentation
Alfonso Gabriel López Ceballos
 
PPT
Xpath
Manav Prasad
 
PPT
XPath - XML Path Language
yht4ever
 
PPTX
Overview of XSL, XPath and XSL-FO
Suite Solutions
 
PPTX
Document Object Model
Mayur Mudgal
 
PDF
XSLT and XPath - without the pain!
Bertrand Delacretaz
 
PPTX
Xml dom
sana mateen
 
PPT
Java XML Parsing
srinivasanjayakumar
 
PPT
DOM ( Document Object Model )
ITSTB
 
PPTX
XML Document Object Model (DOM)
BOSS Webtech
 
PPT
Quizlet.com
Jamie Dykema
 
PPTX
Code of armas tercer parcial
dragonastro
 
PPT
The not so short introduction to Kinect
AXM
 
DOCX
Sqlserver 2012 installation step by step
Oracle Apps DBA
 
XML and XPath details
DSK Chakravarthy
 
Xml processors
Saurav Mawandia
 
Understanding XML DOM
Om Vikram Thapa
 
XML SAX PARSING
Eviatar Levy
 
Learning XSLT
Overdue Books LLC
 
XPath - XML Path Language
yht4ever
 
Overview of XSL, XPath and XSL-FO
Suite Solutions
 
Document Object Model
Mayur Mudgal
 
XSLT and XPath - without the pain!
Bertrand Delacretaz
 
Xml dom
sana mateen
 
Java XML Parsing
srinivasanjayakumar
 
DOM ( Document Object Model )
ITSTB
 
XML Document Object Model (DOM)
BOSS Webtech
 
Quizlet.com
Jamie Dykema
 
Code of armas tercer parcial
dragonastro
 
The not so short introduction to Kinect
AXM
 
Sqlserver 2012 installation step by step
Oracle Apps DBA
 

Similar to XML/XSLT (20)

PPS
eXtensible Markup Language
Aditya Raj
 
DOCX
Xml material
prathap kumar
 
DOCX
Xml material
prathap kumar
 
DOCX
Xml material
xavier john
 
PPT
Xml description
sonam gupta
 
PDF
xml2cdvcx vnbm,azsdfghjkml;sxdfcgmndxfcgvhb nmfctgvbhjnm ,cfgvb nm,xc vb.pdf
kavigamage62
 
PPTX
BITM3730 10-31.pptx
MattMarino13
 
PPTX
BITM3730 10-18.pptx
MattMarino13
 
DOCX
Introduction to xml
Abhishek Kesharwani
 
PPT
Xml iet 2015
kiransurariya
 
PPT
Xml
guestcacd813
 
PPT
01 Xml Begin
Dennis Pipper
 
DOCX
Xml 150323102007-conversion-gate01
Niraj Bharambe
 
PPTX
BITM3730Week5.pptx
MattMarino13
 
PPT
Xml and Co.
Findik Dervis
 
DOCX
Unit 2.2
Abhishek Kesharwani
 
PDF
light_xml
Jennifer Power
 
PPT
Xml
Sudharsan S
 
eXtensible Markup Language
Aditya Raj
 
Xml material
prathap kumar
 
Xml material
prathap kumar
 
Xml material
xavier john
 
Xml description
sonam gupta
 
xml2cdvcx vnbm,azsdfghjkml;sxdfcgmndxfcgvhb nmfctgvbhjnm ,cfgvb nm,xc vb.pdf
kavigamage62
 
BITM3730 10-31.pptx
MattMarino13
 
BITM3730 10-18.pptx
MattMarino13
 
Introduction to xml
Abhishek Kesharwani
 
Xml iet 2015
kiransurariya
 
01 Xml Begin
Dennis Pipper
 
Xml 150323102007-conversion-gate01
Niraj Bharambe
 
BITM3730Week5.pptx
MattMarino13
 
Xml and Co.
Findik Dervis
 
light_xml
Jennifer Power
 
Ad

More from thinkahead.net (13)

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

Recently uploaded (20)

PDF
CloudStack GPU Integration - Rohit Yadav
ShapeBlue
 
PPTX
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
PDF
Smart Air Quality Monitoring with Serrax AQM190 LITE
SERRAX TECHNOLOGIES LLP
 
PDF
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
PDF
Apache CloudStack 201: Let's Design & Build an IaaS Cloud
ShapeBlue
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
PPTX
Top Managed Service Providers in Los Angeles
Captain IT
 
PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
PPTX
Building and Operating a Private Cloud with CloudStack and LINBIT CloudStack ...
ShapeBlue
 
PDF
Sustainable and comertially viable mining process.pdf
Avijit Kumar Roy
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PDF
Shuen Mei Parth Sharma Boost Productivity, Innovation and Efficiency wit...
AWS Chicago
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
PDF
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
CloudStack GPU Integration - Rohit Yadav
ShapeBlue
 
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
Smart Air Quality Monitoring with Serrax AQM190 LITE
SERRAX TECHNOLOGIES LLP
 
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
Apache CloudStack 201: Let's Design & Build an IaaS Cloud
ShapeBlue
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
Top Managed Service Providers in Los Angeles
Captain IT
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
Building and Operating a Private Cloud with CloudStack and LINBIT CloudStack ...
ShapeBlue
 
Sustainable and comertially viable mining process.pdf
Avijit Kumar Roy
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
Shuen Mei Parth Sharma Boost Productivity, Innovation and Efficiency wit...
AWS Chicago
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 

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>