1 / 20

XSLT e X tensible S tylesheet L anguage T ransformations

XSLT e X tensible S tylesheet L anguage T ransformations. Naveed Arshad. Agenda. What is XSL, XSLT and Xpath Advantages of XSLT XSLT Architecture XSLT Processing Model An Example of XSLT Current State of XSLT References. What is XSL, XSLT and Xpath? .

Download Presentation

XSLT e X tensible S tylesheet L anguage T ransformations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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? (cont’d) • 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 <xsl:value-of select="sum(//book/@price) div count(//book)"/>

  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. 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

  8. 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

  9. Input: XML DOCUMENT (Source Tree) <?xml version="1.0" encoding="utf-8" standalone="yes"?> <Catalog> <Book> <Title>Designing Distributed Applications</Title> <Authors> <Author>Stephen Mohr</Author> </Authors> <PubDate>May 1999</PubDate> <ISBN>1-861002-27-0</ISBN> <Price>$49.99</Price> </Book>

  10. <Book> <Title>Professional ASP 3.0</Title> <Authors> <Author>Alex Homer</Author> <Author>Brian Francis</Author> <Author>David Sussman</Author> </Authors> <PubDate>October 1999</PubDate> <ISBN>1-861002-61-0</ISBN> <Price>$59.99</Price> </Book> </Catalog>

  11. XSLT Stylesheet <?xml version="1.0" encoding="utf-8" standalone="yes"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="Catalog"> <Books> <xsl:apply-templates/> </Books> </xsl:template>

  12. <xsl:template match="Book"> <Book> <xsl:value-of select="Title"/>, <xsl:value-of select="PubDate"/> </Book> </xsl:template> </xsl:stylesheet>

  13. Output: XML Document (Result Tree) <?xml version="1.0" encoding="utf-8"?> <Books> <Book> Designing Distributed Applications, May1999 </Book> <Book> Professional ASP 3.0, October 1999 </Book> </Books>

  14. XSLT Processors Source: http://www.tfi-technology.com/xml/xslbench.html

  15. 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

  16. 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

  17. References • XSLT Programmer’s 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/

More Related