XSLT eXtensible Stylesheet Language Transformations PowerPoint PPT Presentation

presentation player overlay
About This Presentation
Transcript and Presenter's Notes

Title: XSLT eXtensible Stylesheet Language Transformations


1
XSLTeXtensible Stylesheet Language
Transformations
  • Naveed Arshad

2
Agenda
  • What is XSL, XSLT and Xpath
  • Advantages of XSLT
  • XSLT Architecture
  • XSLT Processing Model
  • An Example of XSLT
  • Current State of XSLT
  • References

3
What is XSL, XSLT and Xpath?
  • Started of with XSL (eXtensible Stylesheet
    Language)
  • For XML TRANSFORMATION and FORMATING
  • XSLT for TRANSFORMATIONS and XSL for the rest

4
What is XSL, XSLT and Xpath? (contd)
  • Significant overlap in
  • Expression Syntax of XSLT
  • Linking one document to the another using
    XPointer
  • Two committees joined hands to make it one
    language
  • XPATH
  • Example
  • ltxslvalue-of select"sum(//book/_at_price) div
    count(//book)"/gt

5
Advantages of XSLT
  • Transformation from
  • XML document to another XML document
  • XML document to an HTML document
  • XML document to any text form -)

6
XSLT Architecture
  • Source Tree as Input
  • Result Tree as Output
  • XSLT processor takes two inputs
  • XSL style sheet
  • XML Document as Source Tree

7
(No Transcript)
8
XSLT Processing Model
  • Input in form of a tree thus inherently a
  • Recursive Process
  • Checks for template when a new item is
    encountered
  • Transform source nodes into result nodes
  • Rearranges the items based on style sheet

9
(No Transcript)
10
XSLT Example
  • XML to XML
  • Takes one XML document as Source Tree
  • Apply templates using XSLT stylesheet
  • Transforms it into another XML document as a
    Result Tree

11
Input XML DOCUMENT (Source Tree) lt?xml
version"1.0" encoding"utf-8" standalone"yes"?gt
ltCataloggt ltBookgt ltTitlegtDesigning Distributed
Applicationslt/Titlegt ltAuthorsgt ltAuthorgtStephen
Mohrlt/Authorgt lt/Authorsgt ltPubDategtMay
1999lt/PubDategt ltISBNgt1-861002-27-0lt/ISBNgt
ltPricegt49.99lt/Pricegt lt/Bookgt
12
ltBookgt ltTitlegtProfessional ASP 3.0lt/Titlegt
ltAuthorsgt ltAuthorgtAlex Homerlt/Authorgt
ltAuthorgtBrian Francislt/Authorgt ltAuthorgtDavid
Sussmanlt/Authorgt lt/Authorsgt ltPubDategtOctober
1999lt/PubDategt ltISBNgt1-861002-61-0lt/ISBNgt
ltPricegt59.99lt/Pricegt lt/Bookgt lt/Cataloggt
13
(No Transcript)
14
XSLT Stylesheet lt?xml version"1.0"
encoding"utf-8" standalone"yes"?gt
ltxslstylesheet version"1.0" xmlnsxsl"http//ww
w.w3.org/1999/XSL/Transform"gt ltxsltemplate
match"/"gt ltxslapply-templates/gt
lt/xsltemplategt ltxsltemplate match"Catalog"gt
ltBooksgt ltxslapply-templates/gt lt/Booksgt
lt/xsltemplategt
15
ltxsltemplate match"Book"gt ltBookgt
ltxslvalue-of select"Title"/gt, ltxslvalue-of
select"PubDate"/gt lt/Bookgt lt/xsltemplategt
lt/xslstylesheetgt
16
Output XML Document (Result Tree) lt?xml
version"1.0" encoding"utf-8"?gt ltBooksgt
ltBookgt Designing Distributed Applications,
May1999 lt/Bookgt ltBookgt Professional ASP 3.0,
October 1999 lt/Bookgt lt/Booksgt
17
XSLT Processors
Processor Average Score
Napa 0.4 21.80
MSXML 3 40.60
SUN XSLTC Beta 4 51.08
XT 64.24
Saxon 6.0.1 73.44
Resin 1.2b3 90.62
Xalan Java 2.0.D07 103.92
Sabletron 0.44 116.30
Oracle Java V2 2.0.9 122.88
Xalan C 0.40 202.55
Xalan Java 1.2.2 212.54
Source http//www.tfi-technology.com/xml/xslbench
.html
18
What about CSS and CSS2
  • CSS lacks the ability to format the ouput
  • Rule of thumb
  • CSS is used at the Client End
  • XSLT is used on the Server End

19
Current Status of XSLT
  • As of Sep 12th, 2001
  • XSLT 1.0 is part of the XML family
    Recommendations
  • XSLT 1.1 working draft is released on
  • Aug 23rd 2002
  • will be the basis of XSLT 2.0

20
References
  • XSLT Programmers Reference
  • http//www.topxml.com/xsl/articles/xslt_what_about
    /
  • XSLT Quick Referance
  • http//www.mulberrytech.com/quickref/XSLTquickref.
    pdf
  • XSLT Specifications
  • http//www.w3.org/Style/XSL/
  • XSLT News and Resrources
  • http//www.ibiblio.org/xml/
Write a Comment
User Comments (0)
About PowerShow.com