SlideShare une entreprise Scribd logo
1  sur  21
 An XML transformation language is
a programming language designed
specifically to transform
an input XML document into an output
document which satisfies some specific goal.
 There are two special cases of
transformation:
 XML to XML: the output document is an XML
document.
 XML to Data: the output document is a byte
stream.
 XSLT
- XSLT is a language for transforming
XML documents into XHTML documents or
to other XML documents.
 XPATH
- XPath is a language for navigating in XML
documents.
 XQUERY
- XQuery was designed to query XML data.
 XSLT stands for XSL Transformations
 XSLT is the most important part of XSL
 XSL stands for
EXtensible Stylesheet Language.
 XSL describes how the XML document should
be displayed
 XSLT transforms an XML document into
another XML document
 XSLT uses XPath to navigate in XML
documents
 XSLT is a W3C Recommendation
 The root element that declares the document
to be an XSL style sheet is <xsl:stylesheet>
or <xsl:transform>.
 <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Tr
ansform">
 Or
 <xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Tr
ansform">
 XPath is used to navigate through elements and
attributes in an XML document.
 XPath is a syntax for defining parts of an XML
document
 XPath uses path expressions to navigate in XML
documents
 XPath contains a library of standard functions
 XPath is a major element in XSLT
 XPath is a W3C recommendation
 XPath uses path expressions to select nodes or
node-sets in an XML document.
 The <xsl:template> element is used to build
templates.
 The match attribute is used to associate a
template with an XML element. The match
attribute can also be used to define a
template for the entire XML document. The
value of the match attribute is an XPath
expression (i.e. match="/" defines the whole
document).
 The <xsl:value-of> Element
 The <xsl:value-of> element can be used to
extract the value of an XML element and add
it to the Output stream of the transformation
 The <xsl:for-each> Element
 The XSL <xsl:for-each> element can be used
to select every XML element of a specified
node-set:
 Example:
 We want to transform the following XML document ("cdcatalog.xml") into HTML:
 <?xml version="1.0" encoding="UTF-8"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
<cd>
<title>Hide your heart</title>
<artist>Bonnie Tyler</artist>
<country>USA</country>
<company>Columbia</company>
<price>20.90</price>
<year>1986</year>
</cd>
</catalog>
Save it as cdcatalog.xml
 Then you create an XSL Style Sheet ("cdcatalog.xsl") with a transformation template:
 <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="artist"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Add the XSL style sheet reference to your XML document ("cdcatalog.xml"):
 <?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
<cd>
<title>Hide your heart</title>
<artist>Bonnie Tyler</artist>
<country>USA</country>
<company>Columbia</company>
<price>20.90</price>
<year>1986</year>
</cd>
</catalog>
 XQuery is designed to query XML data - not
just XML files, but anything that can appear
as XML, including databases.
 XQuery is the language for querying XML data
 XQuery for XML is like SQL for databases
 XQuery is built on XPath expressions
 XQuery is supported by all major databases
 XQuery is a W3C Recommendation
 XQuery is a language for finding and
extracting elements and attributes from XML
documents.
 Functions
 XQuery uses functions to extract data from
XML documents.
 The doc() function is used to open the
"books.xml" file:
 doc("books.xml")
 Path Expressions
 XQuery uses path expressions to navigate
through elements in an XML document.
 The following path expression is used to
select all the title elements in the "books.xml"
file:
 doc("books.xml")/bookstore/book/title
 (/bookstore selects the bookstore element,
/book selects all the book elements under the
bookstore element, and /title selects all the
title elements under each book element)
 doc("books.xml")/bookstore/book[price>30]/
title
 The expression above will select all the title
elements under the book elements that are
under the bookstore element that have a
price element with a value that is higher than
30.
 XLink is short for XML Linking Language
 XLink is used to create hyperlinks in XML
documents
 Any element in an XML document can behave as
a link
 XLink supports simple links (like HTML) and
extended links (for linking multiple resources
together)
 With XLink, the links can be defined outside the
linked files
 XLink is a W3C Recommendation
 <?xml version="1.0" encoding="UTF-8"?>
<homepages
xmlns:xlink="http://www.w3.org/1999/xlink">
<homepage xlink:type="simple"
xlink:href="http://www.w3schools.com">Visit
W3Schools</homepage>
<homepage xlink:type="simple"
xlink:href="http://www.w3.org">Visit
W3C</homepage>
</homepages>
 http://www.w3schools.com
 http://en.wikipedia.org/wiki/XML_transforma
tion_language

Contenu connexe

Tendances (20)

Xml ppt
Xml pptXml ppt
Xml ppt
 
Xml
XmlXml
Xml
 
Xml Schema
Xml SchemaXml Schema
Xml Schema
 
XSLT presentation
XSLT presentationXSLT presentation
XSLT presentation
 
Xml dtd
Xml dtdXml dtd
Xml dtd
 
XML
XMLXML
XML
 
03 namespace
03 namespace03 namespace
03 namespace
 
XSLT. Basic.
XSLT. Basic.XSLT. Basic.
XSLT. Basic.
 
Xml schema
Xml schemaXml schema
Xml schema
 
DTD
DTDDTD
DTD
 
XML Schemas
XML SchemasXML Schemas
XML Schemas
 
javascript objects
javascript objectsjavascript objects
javascript objects
 
XML and DTD
XML and DTDXML and DTD
XML and DTD
 
Xpath presentation
Xpath presentationXpath presentation
Xpath presentation
 
Transforming xml with XSLT
Transforming  xml with XSLTTransforming  xml with XSLT
Transforming xml with XSLT
 
XML-Extensible Markup Language
XML-Extensible Markup Language XML-Extensible Markup Language
XML-Extensible Markup Language
 
Xml presentation
Xml presentationXml presentation
Xml presentation
 
Xml namespace
Xml namespaceXml namespace
Xml namespace
 
Dom parser
Dom parserDom parser
Dom parser
 
Xml parsers
Xml parsersXml parsers
Xml parsers
 

En vedette

Question Four
Question FourQuestion Four
Question Four
bethxl
 
Bao cao jua ki
Bao cao jua kiBao cao jua ki
Bao cao jua ki
Tuan Huy
 
Biotechnology august2013-130926012214-phpapp02
Biotechnology august2013-130926012214-phpapp02Biotechnology august2013-130926012214-phpapp02
Biotechnology august2013-130926012214-phpapp02
Supa Buoy
 
Visita al cole de una ilustradora
Visita al cole de una ilustradoraVisita al cole de una ilustradora
Visita al cole de una ilustradora
1ciclo2013-14
 
Energia eva georgana 4rtA
Energia eva georgana 4rtAEnergia eva georgana 4rtA
Energia eva georgana 4rtA
evaelfk
 
Module thong ke truy cap va footer
Module thong ke truy cap va footerModule thong ke truy cap va footer
Module thong ke truy cap va footer
Tuan Huy
 
GIL_2012_Africa_BU_Presentation_on_Mega_Trends_Africa_Telecoms_and_IT_by_Chan...
GIL_2012_Africa_BU_Presentation_on_Mega_Trends_Africa_Telecoms_and_IT_by_Chan...GIL_2012_Africa_BU_Presentation_on_Mega_Trends_Africa_Telecoms_and_IT_by_Chan...
GIL_2012_Africa_BU_Presentation_on_Mega_Trends_Africa_Telecoms_and_IT_by_Chan...
Chantel Lindeman
 

En vedette (18)

Lebowski Publishers - Najaar 2014
Lebowski Publishers - Najaar 2014Lebowski Publishers - Najaar 2014
Lebowski Publishers - Najaar 2014
 
Question Four
Question FourQuestion Four
Question Four
 
Bao cao jua ki
Bao cao jua kiBao cao jua ki
Bao cao jua ki
 
Mypp
MyppMypp
Mypp
 
Biotechnology august2013-130926012214-phpapp02
Biotechnology august2013-130926012214-phpapp02Biotechnology august2013-130926012214-phpapp02
Biotechnology august2013-130926012214-phpapp02
 
North east
North eastNorth east
North east
 
Clase de ed
Clase de edClase de ed
Clase de ed
 
about Pangkalpinang in English
about Pangkalpinang in Englishabout Pangkalpinang in English
about Pangkalpinang in English
 
Visita al cole de una ilustradora
Visita al cole de una ilustradoraVisita al cole de una ilustradora
Visita al cole de una ilustradora
 
Elsevier: CSUN Alt Text Project
Elsevier: CSUN Alt Text ProjectElsevier: CSUN Alt Text Project
Elsevier: CSUN Alt Text Project
 
Hosting
HostingHosting
Hosting
 
Bar charts for questtionnaire
Bar charts for questtionnaireBar charts for questtionnaire
Bar charts for questtionnaire
 
Energia eva georgana 4rtA
Energia eva georgana 4rtAEnergia eva georgana 4rtA
Energia eva georgana 4rtA
 
Module thong ke truy cap va footer
Module thong ke truy cap va footerModule thong ke truy cap va footer
Module thong ke truy cap va footer
 
Designing & Managing Product
Designing & Managing ProductDesigning & Managing Product
Designing & Managing Product
 
Representation
RepresentationRepresentation
Representation
 
What can my school of talk do for you
What can my school of talk do for youWhat can my school of talk do for you
What can my school of talk do for you
 
GIL_2012_Africa_BU_Presentation_on_Mega_Trends_Africa_Telecoms_and_IT_by_Chan...
GIL_2012_Africa_BU_Presentation_on_Mega_Trends_Africa_Telecoms_and_IT_by_Chan...GIL_2012_Africa_BU_Presentation_on_Mega_Trends_Africa_Telecoms_and_IT_by_Chan...
GIL_2012_Africa_BU_Presentation_on_Mega_Trends_Africa_Telecoms_and_IT_by_Chan...
 

Similaire à Xml transformation language (20)

Xslt
XsltXslt
Xslt
 
Xslt
XsltXslt
Xslt
 
Introduction to XSLT
Introduction to XSLTIntroduction to XSLT
Introduction to XSLT
 
XPATH_XSLT-1.pptx
XPATH_XSLT-1.pptxXPATH_XSLT-1.pptx
XPATH_XSLT-1.pptx
 
Xslt
XsltXslt
Xslt
 
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
 
Session 4
Session 4Session 4
Session 4
 
Xml 2
Xml  2 Xml  2
Xml 2
 
Chapter 18
Chapter 18Chapter 18
Chapter 18
 
Xml
XmlXml
Xml
 
Xml nisha dwivedi
Xml nisha dwivediXml nisha dwivedi
Xml nisha dwivedi
 
Xml 215-presentation
Xml 215-presentationXml 215-presentation
Xml 215-presentation
 
Xslt elements
Xslt elementsXslt elements
Xslt elements
 
Xml and DTD's
Xml and DTD'sXml and DTD's
Xml and DTD's
 
Rendering XML Documents
Rendering XML DocumentsRendering XML Documents
Rendering XML Documents
 
Introduction of xml and xslt
Introduction of xml and xsltIntroduction of xml and xslt
Introduction of xml and xslt
 
XML/XSLT
XML/XSLTXML/XSLT
XML/XSLT
 
Xslt attributes
Xslt attributesXslt attributes
Xslt attributes
 
transforming xml using xsl and xslt
transforming xml using xsl and xslttransforming xml using xsl and xslt
transforming xml using xsl and xslt
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Dernier (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

Xml transformation language

  • 1.
  • 2.  An XML transformation language is a programming language designed specifically to transform an input XML document into an output document which satisfies some specific goal.  There are two special cases of transformation:  XML to XML: the output document is an XML document.  XML to Data: the output document is a byte stream.
  • 3.  XSLT - XSLT is a language for transforming XML documents into XHTML documents or to other XML documents.  XPATH - XPath is a language for navigating in XML documents.  XQUERY - XQuery was designed to query XML data.
  • 4.  XSLT stands for XSL Transformations  XSLT is the most important part of XSL  XSL stands for EXtensible Stylesheet Language.  XSL describes how the XML document should be displayed  XSLT transforms an XML document into another XML document  XSLT uses XPath to navigate in XML documents  XSLT is a W3C Recommendation
  • 5.  The root element that declares the document to be an XSL style sheet is <xsl:stylesheet> or <xsl:transform>.  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Tr ansform">  Or  <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Tr ansform">
  • 6.  XPath is used to navigate through elements and attributes in an XML document.  XPath is a syntax for defining parts of an XML document  XPath uses path expressions to navigate in XML documents  XPath contains a library of standard functions  XPath is a major element in XSLT  XPath is a W3C recommendation  XPath uses path expressions to select nodes or node-sets in an XML document.
  • 7.
  • 8.
  • 9.  The <xsl:template> element is used to build templates.  The match attribute is used to associate a template with an XML element. The match attribute can also be used to define a template for the entire XML document. The value of the match attribute is an XPath expression (i.e. match="/" defines the whole document).
  • 10.  The <xsl:value-of> Element  The <xsl:value-of> element can be used to extract the value of an XML element and add it to the Output stream of the transformation  The <xsl:for-each> Element  The XSL <xsl:for-each> element can be used to select every XML element of a specified node-set:
  • 11.  Example:  We want to transform the following XML document ("cdcatalog.xml") into HTML:  <?xml version="1.0" encoding="UTF-8"?> <catalog> <cd> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> </cd> <cd> <title>Hide your heart</title> <artist>Bonnie Tyler</artist> <country>USA</country> <company>Columbia</company> <price>20.90</price> <year>1986</year> </cd> </catalog> Save it as cdcatalog.xml
  • 12.  Then you create an XSL Style Sheet ("cdcatalog.xsl") with a transformation template:  <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>My CD Collection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Title</th> <th>Artist</th> </tr> <xsl:for-each select="catalog/cd"> <tr> <td><xsl:value-of select="title"/></td> <td><xsl:value-of select="artist"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
  • 13. Add the XSL style sheet reference to your XML document ("cdcatalog.xml"):  <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?> <catalog> <cd> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> </cd> <cd> <title>Hide your heart</title> <artist>Bonnie Tyler</artist> <country>USA</country> <company>Columbia</company> <price>20.90</price> <year>1986</year> </cd> </catalog>
  • 14.
  • 15.  XQuery is designed to query XML data - not just XML files, but anything that can appear as XML, including databases.  XQuery is the language for querying XML data  XQuery for XML is like SQL for databases  XQuery is built on XPath expressions  XQuery is supported by all major databases  XQuery is a W3C Recommendation  XQuery is a language for finding and extracting elements and attributes from XML documents.
  • 16.  Functions  XQuery uses functions to extract data from XML documents.  The doc() function is used to open the "books.xml" file:  doc("books.xml")
  • 17.  Path Expressions  XQuery uses path expressions to navigate through elements in an XML document.  The following path expression is used to select all the title elements in the "books.xml" file:  doc("books.xml")/bookstore/book/title  (/bookstore selects the bookstore element, /book selects all the book elements under the bookstore element, and /title selects all the title elements under each book element)
  • 18.  doc("books.xml")/bookstore/book[price>30]/ title  The expression above will select all the title elements under the book elements that are under the bookstore element that have a price element with a value that is higher than 30.
  • 19.  XLink is short for XML Linking Language  XLink is used to create hyperlinks in XML documents  Any element in an XML document can behave as a link  XLink supports simple links (like HTML) and extended links (for linking multiple resources together)  With XLink, the links can be defined outside the linked files  XLink is a W3C Recommendation
  • 20.  <?xml version="1.0" encoding="UTF-8"?> <homepages xmlns:xlink="http://www.w3.org/1999/xlink"> <homepage xlink:type="simple" xlink:href="http://www.w3schools.com">Visit W3Schools</homepage> <homepage xlink:type="simple" xlink:href="http://www.w3.org">Visit W3C</homepage> </homepages>