SlideShare una empresa de Scribd logo
1 de 64
XSLT Md. Asfak Mahamud Associate Software Engineer KAZ Software Ltd. Dhaka, Bangladesh February 19, 2008
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],It’s Wonderful Life James Stewart  Donna Reed  Lionel Barrymore  Frank Capra Liberty Film Inc.
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],It’s Wonderful Life James Stewart  Donna Reed  Lionel Barrymore  Frank Capra Liberty Film Inc.
Trailer (continued) XSLT processor hello.xml hello.xsl hello.html
Trailer (continued) XSLT processor
Trailer (continued) Transform.java
Trailer (continued) Streamsource  of XSL File XSL File StreamSource  of XML File XML File transformer StreamResult of Html File
Trailer (continued) Streamsource  of XSL File XSL File StreamSource  of XML File XML File StreamResult of Html File Html File StreamSource  of XML File StreamResult of Html File
Trailer (continued) TransformerFactory   tFactory   = TransformerFactory. newInstance (); StreamSource   xslStreamSource   = new StreamSource(xslDoc); Transformer   transformer   = tFactory.newTransformer(stylesource); StreamSource   xmlStreamSource   = new StreamSource(new File(xmlDoc)); StreamResult   htmlStreamResult   = new StreamResult(new FileOutputStream(htmlDoc)); transformer.transform ( xmlStreamSource ,  htmlStreamResult );
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],It’s Wonderful Life James Stewart  Donna Reed  Lionel Barrymore  Frank Capra Liberty Film Inc.
Cast   XML ,[object Object],[object Object]
Cast   XML
Cast   XML
Cast   XML  with CSS
Cast   XML  with XSL
Cast ,[object Object]
Cast   XPath
Cast   XPath
Cast   XPath
Cast   XPath
Cast   XPath
Cast   XPath
Cast   XPath
Cast ,[object Object]
Cast   XSL/XSLT
Cast   XSL/XSLT ,[object Object]
Cast   XSL/XSLT
Cast   XSL/XSLT  Functions ,[object Object],[object Object]
Cast   XSL/XSLT ,[object Object]
Cast   XSL/XSLT ,[object Object]
Cast   XSL/XSLT ,[object Object]
Cast   XSL/XSLT ,[object Object]
[object Object],Cast   XSL/XSLT
[object Object],[object Object],Cast   XSL/XSLT
[object Object],Cast   XSL/XSLT
Cast   XSL/XSLT
[object Object],Cast   XSL/XSLT
[object Object],[object Object],[object Object],Cast   XSL/XSLT
Two Important Functions: Boolean element-available(string) Boolean function-available(string) Cast   XSL/XSLT
Cast   XSL/XSLT  Extention-Elements
Example: Generating multiple output file
Cast   XSL/XSLT   Extention Function ,[object Object],[object Object],[object Object],[object Object],[object Object]
To write a stylesheet that will work with multiple XSLT processors? <xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=“ http://www.w3.org/1999/XSL/Transform ”     xmlns:redirect =&quot; org.apache.xalan.xslt.extensions.Redirect &quot;    xmlns:saxon =&quot; http://icl.com/saxon &quot;    xmlns:xt =&quot; http://www.jclark.com/xt &quot;    extension-element-prefixes =&quot; redirect saxon xt &quot; > Cast   XSL/XSLT
Writing extensions in other languages Cast   XSL/XSLT <lxslt:component prefix=&quot;javascript-extension“ functions=&quot;cos sin toRadians&quot;> <lxslt:script lang=&quot;javascript&quot;> function cos(d) {  return Math.cos(d);  } function sin(d) {  return Math.sin(d);  } function toRadians(d) {  return d * Math.PI / 180;  }  </lxslt:script> </lxslt:component>
Fallback Processing Cast   XSL/XSLT
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],It’s Wonderful Life James Stewart  Donna Reed  Lionel Barrymore  Frank Capra Liberty Film Inc.
Director   XSLT Processors ,[object Object],[object Object],[object Object]
Director   Java API ,[object Object],[object Object],[object Object]
Producer   Transformation
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],It’s Wonderful Life James Stewart  Donna Reed  Lionel Barrymore  Frank Capra Liberty Film Inc.
Production ,[object Object],[object Object]
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],It’s Wonderful Life James Stewart  Donna Reed  Lionel Barrymore  Frank Capra Liberty Film Inc.
Discussion ,[object Object],[object Object],[object Object],[object Object],[object Object]
Discussion  XSLT 2.0 - Grouping <paper> <title> XML and PDF in Publishing Workflows</title> <author> Myers, Charles </author> </paper> <paper> <title> On the Way to XML</title> <author> Parsons, Jonathan </author> <author> Caisley, Phil </author> </paper> <author> <name>Caisley, Phil</name> <paper> On the Way to XML </paper> </author> <author> <name>Myers, Charles</name> <paper> XML and PDF in Publishing Workflows </paper> </author> <author> <name> Parsons, Jonathan</name> <paper> On the Way to XML </paper> </author>
Discussion  XSLT 2.0 - Grouping ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
<paper> <title> XML and PDF in Publishing Workflows</title> <author> Myers, Charles </author> </paper> <paper> <title> On the Way to XML</title> <author> Parsons, Jonathan </author> <author> Caisley, Phil </author> </paper> <author> <name>Caisley, Phil</name> <paper> On the Way to XML </paper> </author> <author> <name>Myers, Charles</name> <paper> XML and PDF in Publishing Workflows </paper> </author> <author> <name> Parsons, Jonathan</name> <paper> On the Way to XML </paper> </author> <xsl:for-each-group  select= &quot;paper&quot; group-by= &quot;author&quot; > <xsl:sort select=&quot;current-grouping-key()&quot; /> <author> <name> <xsl:value-of select=&quot;current-grouping-key()&quot; /> </name> <xsl:for-each select=&quot;current-group()&quot;> <paper> <xsl:value-of select=&quot;title&quot; /> </paper> </xsl:for-each> </author> </xsl:for-each-group>
Discussion  XSLT 2.0 - Function Definitions
Discussion  XSLT 2.0 -  Multiple Result Documents ,[object Object],[object Object],<xsl:for-each select=&quot;section&quot;> <xsl:result-document href=&quot;{@id}.html&quot;> <xsl:apply-templates select=&quot;.&quot;  mode=&quot;html&quot; /> </xsl:result-document> </xsl:for-each>
Discussion  XSLT 2.0 -  Typing ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Discussion  XSLT 2.0 -  Typing ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],<xsl:function name=&quot;math:power&quot;> <xsl:param name=&quot;base&quot; as=&quot;xs:decimal&quot; /> <xsl:param name=&quot;power&quot; as=&quot;xs:integer&quot; /> … </xsl:function>
[object Object]
Discussion XSLT Advantages & Disadvantages ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
References ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
 

Más contenido relacionado

La actualidad más candente

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
 
C:\fakepath\xsl final
C:\fakepath\xsl finalC:\fakepath\xsl final
C:\fakepath\xsl final
shivpriya
 
Introductionto xslt
Introductionto xsltIntroductionto xslt
Introductionto xslt
Kumar
 

La actualidad más candente (20)

XSLT and XPath - without the pain!
XSLT and XPath - without the pain!XSLT and XPath - without the pain!
XSLT and XPath - without the pain!
 
XSLT
XSLTXSLT
XSLT
 
XSLT
XSLTXSLT
XSLT
 
Querring xml with xpath
Querring xml with xpath Querring xml with xpath
Querring xml with xpath
 
Learning XSLT
Learning XSLTLearning XSLT
Learning XSLT
 
5 xsl (formatting xml documents)
5   xsl (formatting xml documents)5   xsl (formatting xml documents)
5 xsl (formatting xml documents)
 
XSLT presentation
XSLT presentationXSLT presentation
XSLT presentation
 
Xslt
XsltXslt
Xslt
 
Xslt
XsltXslt
Xslt
 
transforming xml using xsl and xslt
transforming xml using xsl and xslttransforming xml using xsl and xslt
transforming xml using xsl and xslt
 
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 p5 Lecture Notes
Xml p5 Lecture NotesXml p5 Lecture Notes
Xml p5 Lecture Notes
 
C:\fakepath\xsl final
C:\fakepath\xsl finalC:\fakepath\xsl final
C:\fakepath\xsl final
 
Xml Lecture Notes
Xml Lecture NotesXml Lecture Notes
Xml Lecture Notes
 
Extracting data from xml
Extracting data from xmlExtracting data from xml
Extracting data from xml
 
Introductionto xslt
Introductionto xsltIntroductionto xslt
Introductionto xslt
 
03 x files
03 x files03 x files
03 x files
 
Xsd
XsdXsd
Xsd
 
XML, DTD & XSD Overview
XML, DTD & XSD OverviewXML, DTD & XSD Overview
XML, DTD & XSD Overview
 
Xml schema
Xml schemaXml schema
Xml schema
 

Similar a Xslt by asfak mahamud

Extensible Stylesheet Language
Extensible Stylesheet LanguageExtensible Stylesheet Language
Extensible Stylesheet Language
Jussi Pohjolainen
 
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
 
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
 

Similar a Xslt by asfak mahamud (20)

Week 12 xml and xsl
Week 12 xml and xslWeek 12 xml and xsl
Week 12 xml and xsl
 
Sax Dom Tutorial
Sax Dom TutorialSax Dom Tutorial
Sax Dom Tutorial
 
Inroduction to XSLT with PHP4
Inroduction to XSLT with PHP4Inroduction to XSLT with PHP4
Inroduction to XSLT with PHP4
 
Session 4
Session 4Session 4
Session 4
 
XML Transformations With PHP
XML Transformations With PHPXML Transformations With PHP
XML Transformations With PHP
 
Java XML Parsing
Java XML ParsingJava XML Parsing
Java XML Parsing
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Xml
XmlXml
Xml
 
Working With XML in IDS Applications
Working With XML in IDS ApplicationsWorking With XML in IDS Applications
Working With XML in IDS Applications
 
Extensible Stylesheet Language
Extensible Stylesheet LanguageExtensible Stylesheet Language
Extensible Stylesheet Language
 
eXtensible Markup Language (XML)
eXtensible Markup Language (XML)eXtensible Markup Language (XML)
eXtensible Markup Language (XML)
 
Stax parser
Stax parserStax parser
Stax parser
 
26xslt
26xslt26xslt
26xslt
 
Processing XML with Java
Processing XML with JavaProcessing XML with Java
Processing XML with Java
 
Sakai09 Osp Preconference Afternoon Forms
Sakai09 Osp Preconference Afternoon FormsSakai09 Osp Preconference Afternoon Forms
Sakai09 Osp Preconference Afternoon Forms
 
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
 
Rendering XML Documents
Rendering XML DocumentsRendering XML Documents
Rendering XML Documents
 
XML and Web Services with PHP5 and PEAR
XML and Web Services with PHP5 and PEARXML and Web Services with PHP5 and PEAR
XML and Web Services with PHP5 and PEAR
 
PostgreSQL and XML
PostgreSQL and XMLPostgreSQL and XML
PostgreSQL and XML
 
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...
 

Último

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
 

Último (20)

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...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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...
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
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
 
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)
 
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
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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
 
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
 

Xslt by asfak mahamud

  • 1. XSLT Md. Asfak Mahamud Associate Software Engineer KAZ Software Ltd. Dhaka, Bangladesh February 19, 2008
  • 2.
  • 3.
  • 4. Trailer (continued) XSLT processor hello.xml hello.xsl hello.html
  • 7. Trailer (continued) Streamsource of XSL File XSL File StreamSource of XML File XML File transformer StreamResult of Html File
  • 8. Trailer (continued) Streamsource of XSL File XSL File StreamSource of XML File XML File StreamResult of Html File Html File StreamSource of XML File StreamResult of Html File
  • 9. Trailer (continued) TransformerFactory tFactory = TransformerFactory. newInstance (); StreamSource xslStreamSource = new StreamSource(xslDoc); Transformer transformer = tFactory.newTransformer(stylesource); StreamSource xmlStreamSource = new StreamSource(new File(xmlDoc)); StreamResult htmlStreamResult = new StreamResult(new FileOutputStream(htmlDoc)); transformer.transform ( xmlStreamSource , htmlStreamResult );
  • 10.
  • 11.
  • 12. Cast XML
  • 13. Cast XML
  • 14. Cast XML with CSS
  • 15. Cast XML with XSL
  • 16.
  • 17. Cast XPath
  • 18. Cast XPath
  • 19. Cast XPath
  • 20. Cast XPath
  • 21. Cast XPath
  • 22. Cast XPath
  • 23. Cast XPath
  • 24.
  • 25. Cast XSL/XSLT
  • 26.
  • 27. Cast XSL/XSLT
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36. Cast XSL/XSLT
  • 37.
  • 38.
  • 39. Two Important Functions: Boolean element-available(string) Boolean function-available(string) Cast XSL/XSLT
  • 40. Cast XSL/XSLT Extention-Elements
  • 42.
  • 43. To write a stylesheet that will work with multiple XSLT processors? <xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=“ http://www.w3.org/1999/XSL/Transform ”  xmlns:redirect =&quot; org.apache.xalan.xslt.extensions.Redirect &quot;  xmlns:saxon =&quot; http://icl.com/saxon &quot;  xmlns:xt =&quot; http://www.jclark.com/xt &quot;  extension-element-prefixes =&quot; redirect saxon xt &quot; > Cast XSL/XSLT
  • 44. Writing extensions in other languages Cast XSL/XSLT <lxslt:component prefix=&quot;javascript-extension“ functions=&quot;cos sin toRadians&quot;> <lxslt:script lang=&quot;javascript&quot;> function cos(d) { return Math.cos(d); } function sin(d) { return Math.sin(d); } function toRadians(d) { return d * Math.PI / 180; } </lxslt:script> </lxslt:component>
  • 46.
  • 47.
  • 48.
  • 49. Producer Transformation
  • 50.
  • 51.
  • 52.
  • 53.
  • 54. Discussion XSLT 2.0 - Grouping <paper> <title> XML and PDF in Publishing Workflows</title> <author> Myers, Charles </author> </paper> <paper> <title> On the Way to XML</title> <author> Parsons, Jonathan </author> <author> Caisley, Phil </author> </paper> <author> <name>Caisley, Phil</name> <paper> On the Way to XML </paper> </author> <author> <name>Myers, Charles</name> <paper> XML and PDF in Publishing Workflows </paper> </author> <author> <name> Parsons, Jonathan</name> <paper> On the Way to XML </paper> </author>
  • 55.
  • 56. <paper> <title> XML and PDF in Publishing Workflows</title> <author> Myers, Charles </author> </paper> <paper> <title> On the Way to XML</title> <author> Parsons, Jonathan </author> <author> Caisley, Phil </author> </paper> <author> <name>Caisley, Phil</name> <paper> On the Way to XML </paper> </author> <author> <name>Myers, Charles</name> <paper> XML and PDF in Publishing Workflows </paper> </author> <author> <name> Parsons, Jonathan</name> <paper> On the Way to XML </paper> </author> <xsl:for-each-group select= &quot;paper&quot; group-by= &quot;author&quot; > <xsl:sort select=&quot;current-grouping-key()&quot; /> <author> <name> <xsl:value-of select=&quot;current-grouping-key()&quot; /> </name> <xsl:for-each select=&quot;current-group()&quot;> <paper> <xsl:value-of select=&quot;title&quot; /> </paper> </xsl:for-each> </author> </xsl:for-each-group>
  • 57. Discussion XSLT 2.0 - Function Definitions
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.