SlideShare una empresa de Scribd logo
1 de 22
 A peek into the world  of XSLT Author Neenu George
“Style is what gives value and currency to thoughts.” Arthur Schopenhauer (1788-1860) German philosopher. “Style is a simple way of saying complicated things” 				Jean Cocteau (1889-1963) French author and filmmaker. “The proper words in the proper places are the true definition of style.” Jonathan Swift (1667-1745) Irish-born English satirist.
AGENDA ,[object Object]
Programming with XSLT
Example
Use of XSLT in Polaris Application
Conclusion
Q&A,[object Object]
What is XSLT? XSL stands for EXtensibleStylesheet Language Language for transforming XML documents A programming language for XML documents A functional language, based on value substitution Augmented with pattern matching And also template substitution to construct output (based on namespaces Uses XML syntax
XSLT in Motion
Why transform? ,[object Object]
I say potato, you say paragraph
Rearrange data for formatting,[object Object]
Correct Style Sheet Declaration The root element that declares the document to be an XSL style sheet is <xsl:stylesheet> or <xsl:transform> W3C XSLT Recommendation is:     <xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="myTemplateName">      ...body of template...      </xsl:template> set of rules that are called templates A template contains rules to apply when a specified node is matched. Acts as functions in java <xsl:call-template name="myTemplateName"/> XSLT <xsl:template> Element
used to extract the value of a selected node. <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 <xsl:value-of select="XPath expression"/> selects the contents of an element and adds it to the output stream  XSLT <xsl:value-of> Element
element allows you to do looping in XSLT <xsl:for-each> element can be used to select every XML element of a specified node-set <xsl:for-each select="XPath expression">  XSLT <xsl:foreach> Elements
XSLT <xsl:sort> Element <xsl:sort> element is used to sort the output. To sort the output, simply add an <xsl:sort> element inside the <xsl:for-each> element in the XSL file: xsl:sort select="author"/>
XSLT <xsl:if> Element <xsl:if> element is used to put a conditional test against the content of the XML file test against the content of the XML file, add an <xsl:if> element to the XSL document. <xsl:if test="expression">  <!-- Content: template --></xsl:if>
XSLT <xsl:choose> Element The <xsl:choose> element is used in conjunction with <xsl:when> and <xsl:otherwise> to express multiple conditional tests. <xsl:choose>  <xsl:when test="expression">    ... some output ...  </xsl:when>  <xsl:otherwise>    ... some output ....  </xsl:otherwise></xsl:choose>
XPath and its use in XSLT ,[object Object]
Used to identify sets of elements

Más contenido relacionado

La actualidad más candente

Xml transformation language
Xml transformation languageXml transformation language
Xml transformation language
reshmavasudev
 
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
Bình Trọng Án
 
Introductionto xslt
Introductionto xsltIntroductionto xslt
Introductionto xslt
Kumar
 

La actualidad más candente (20)

Xslt by asfak mahamud
Xslt by asfak mahamudXslt by asfak mahamud
Xslt by asfak mahamud
 
XML and XSLT
XML and XSLTXML and XSLT
XML and 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!
 
transforming xml using xsl and xslt
transforming xml using xsl and xslttransforming xml using xsl and xslt
transforming xml using xsl and xslt
 
Learning XSLT
Learning XSLTLearning XSLT
Learning XSLT
 
XML XSLT
XML XSLTXML XSLT
XML XSLT
 
Xml transformation language
Xml transformation languageXml transformation language
Xml transformation language
 
Xslt
XsltXslt
Xslt
 
XMLT
XMLTXMLT
XMLT
 
5 xsl (formatting xml documents)
5   xsl (formatting xml documents)5   xsl (formatting xml documents)
5 xsl (formatting xml documents)
 
Querring xml with xpath
Querring xml with xpath Querring xml with xpath
Querring xml with xpath
 
Xml p5 Lecture Notes
Xml p5 Lecture NotesXml p5 Lecture Notes
Xml p5 Lecture Notes
 
XSLT presentation
XSLT presentationXSLT presentation
XSLT presentation
 
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
 
Introductionto xslt
Introductionto xsltIntroductionto xslt
Introductionto xslt
 
Xml Lecture Notes
Xml Lecture NotesXml Lecture Notes
Xml Lecture Notes
 
XML Security Using XSLT
XML Security Using XSLTXML Security Using XSLT
XML Security Using XSLT
 
Xml schema
Xml schemaXml schema
Xml schema
 
Week 12 xml and xsl
Week 12 xml and xslWeek 12 xml and xsl
Week 12 xml and xsl
 
03 x files
03 x files03 x files
03 x files
 

Similar a Xslt tutorial

C:\fakepath\xsl final
C:\fakepath\xsl finalC:\fakepath\xsl final
C:\fakepath\xsl final
shivpriya
 
Extensible Stylesheet Language
Extensible Stylesheet LanguageExtensible Stylesheet Language
Extensible Stylesheet Language
Jussi Pohjolainen
 
Xml For Dummies Chapter 12 Handling Transformations With Xsl it-slideshares...
Xml For Dummies   Chapter 12 Handling Transformations With Xsl it-slideshares...Xml For Dummies   Chapter 12 Handling Transformations With Xsl it-slideshares...
Xml For Dummies Chapter 12 Handling Transformations With Xsl it-slideshares...
phanleson
 
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
Suite Solutions
 
Jsonsaga
JsonsagaJsonsaga
Jsonsaga
nohmad
 

Similar a Xslt tutorial (20)

C:\fakepath\xsl final
C:\fakepath\xsl finalC:\fakepath\xsl final
C:\fakepath\xsl final
 
Session 4
Session 4Session 4
Session 4
 
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
 
Inroduction to XSLT with PHP4
Inroduction to XSLT with PHP4Inroduction to XSLT with PHP4
Inroduction to XSLT with PHP4
 
Xsl xslt
Xsl  xsltXsl  xslt
Xsl xslt
 
XML Transformations With PHP
XML Transformations With PHPXML Transformations With PHP
XML Transformations With PHP
 
XSL- XSLT.pdf
XSL- XSLT.pdfXSL- XSLT.pdf
XSL- XSLT.pdf
 
Xslt
XsltXslt
Xslt
 
Extensible Stylesheet Language
Extensible Stylesheet LanguageExtensible Stylesheet Language
Extensible Stylesheet Language
 
Sakai09 Osp Preconference Afternoon Forms
Sakai09 Osp Preconference Afternoon FormsSakai09 Osp Preconference Afternoon Forms
Sakai09 Osp Preconference Afternoon Forms
 
Xml For Dummies Chapter 12 Handling Transformations With Xsl it-slideshares...
Xml For Dummies   Chapter 12 Handling Transformations With Xsl it-slideshares...Xml For Dummies   Chapter 12 Handling Transformations With Xsl it-slideshares...
Xml For Dummies Chapter 12 Handling Transformations With Xsl it-slideshares...
 
XSLT 3.0 Improvements - XML Prague 2018
XSLT 3.0 Improvements - XML Prague 2018XSLT 3.0 Improvements - XML Prague 2018
XSLT 3.0 Improvements - XML Prague 2018
 
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
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Xml
XmlXml
Xml
 
Xslt
XsltXslt
Xslt
 
Rendering XML Documents
Rendering XML DocumentsRendering XML Documents
Rendering XML Documents
 
Encoding and Presenting Interlinear Text Using XML Technologies
Encoding and Presenting Interlinear Text Using XML TechnologiesEncoding and Presenting Interlinear Text Using XML Technologies
Encoding and Presenting Interlinear Text Using XML Technologies
 
Digital + Container List
Digital + Container ListDigital + Container List
Digital + Container List
 
Jsonsaga
JsonsagaJsonsaga
Jsonsaga
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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
 
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
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
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)
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 

Xslt tutorial

  • 1. A peek into the world of XSLT Author Neenu George
  • 2. “Style is what gives value and currency to thoughts.” Arthur Schopenhauer (1788-1860) German philosopher. “Style is a simple way of saying complicated things” Jean Cocteau (1889-1963) French author and filmmaker. “The proper words in the proper places are the true definition of style.” Jonathan Swift (1667-1745) Irish-born English satirist.
  • 3.
  • 6. Use of XSLT in Polaris Application
  • 8.
  • 9. What is XSLT? XSL stands for EXtensibleStylesheet Language Language for transforming XML documents A programming language for XML documents A functional language, based on value substitution Augmented with pattern matching And also template substitution to construct output (based on namespaces Uses XML syntax
  • 11.
  • 12. I say potato, you say paragraph
  • 13.
  • 14. Correct Style Sheet Declaration The root element that declares the document to be an XSL style sheet is <xsl:stylesheet> or <xsl:transform> W3C XSLT Recommendation is: <xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  • 15. <xsl:template name="myTemplateName"> ...body of template... </xsl:template> set of rules that are called templates A template contains rules to apply when a specified node is matched. Acts as functions in java <xsl:call-template name="myTemplateName"/> XSLT <xsl:template> Element
  • 16. used to extract the value of a selected node. <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 <xsl:value-of select="XPath expression"/> selects the contents of an element and adds it to the output stream  XSLT <xsl:value-of> Element
  • 17. element allows you to do looping in XSLT <xsl:for-each> element can be used to select every XML element of a specified node-set <xsl:for-each select="XPath expression">  XSLT <xsl:foreach> Elements
  • 18. XSLT <xsl:sort> Element <xsl:sort> element is used to sort the output. To sort the output, simply add an <xsl:sort> element inside the <xsl:for-each> element in the XSL file: xsl:sort select="author"/>
  • 19. XSLT <xsl:if> Element <xsl:if> element is used to put a conditional test against the content of the XML file test against the content of the XML file, add an <xsl:if> element to the XSL document. <xsl:if test="expression">  <!-- Content: template --></xsl:if>
  • 20. XSLT <xsl:choose> Element The <xsl:choose> element is used in conjunction with <xsl:when> and <xsl:otherwise> to express multiple conditional tests. <xsl:choose>  <xsl:when test="expression">    ... some output ...  </xsl:when>  <xsl:otherwise>    ... some output ....  </xsl:otherwise></xsl:choose>
  • 21.
  • 22. Used to identify sets of elements
  • 24. “all paragraphs directly inside footnotes”
  • 25. “the section with ID=“sec37”
  • 27. “first paragraph in each section”
  • 28. “the parent of each caption”
  • 29.
  • 30. A template uses Xpath to match nodes
  • 31. Highest priority matching template selected
  • 32. Then the remplate takes over and generates:
  • 33. Literal output XML (based on namespace)
  • 34. Computational results (of XSLT functions)
  • 35. Results of further template applications
  • 36. Results of queries on the document
  • 37.
  • 39. Strategies for XSLT Try to pick a single style as much as possible May vary by project Mixing may be necessary but can get confusing Be sure you understand (and probably override the default rules) Shorter patterns are better <xsl:value-of> and <xsl:if> may be easier to deal with than a complex path
  • 40. References Key siteshttp://www.w3.org/Style/XSL http://www.mulberrytech.com/xsl/xsl-list http://www.oasis-open.org/cover/xsl.html Interactive XSLT reference http://www.zvon.org/xxl/XSLTreference/Output/ XSLT: 2nd Edition Programmer’s Reference Michael Kay [Good reference; clear, but not really a tutorial] XSLT & XPath On the EdgeTennison [And her other books]