SlideShare a Scribd company logo
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]
 

More Related Content

What's hot

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
 

What's hot (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 to 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 to 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...
 

Recently uploaded

Recently uploaded (20)

Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 

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.