1 / 10

XSLT

XSLT. 1.0. Introduction. XSLT – eXtensible Style sheet Language for Transformations Purpose is to transform XML documents from one format into another XSLT is an XML language. How do we use it?. Use XSLT to convert XML documents at server and send to client. Two ways of using XSLT.

ahinkle
Download Presentation

XSLT

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

  2. Introduction • XSLT – eXtensible Style sheet Language for Transformations • Purpose is to transform XML documents from one format into another • XSLT is an XML language

  3. How do we use it? • Use XSLT to convert XML documents at server and send to client.

  4. Two ways of using XSLT • Server side processing • Server does XSLT transformations on server and sends HTML to client • Client-side processing • Server sends XML and the XSLT style sheet to the client which does the transformation • Browser support: IE 6.0

  5. Using XSLT • Multiple ways • From the command prompt • java org.apache.xalan.xslt.Process -in source.xml –xsl stylesheet.xsl[t] –out out.xml • Using a GUI • From http://www.marchal.com

  6. XSLT basics • An XSLT processor merges an XML document into an XSLT style sheet • This merging is a template-driven process • An XSLT style sheet can specify page layout, page orientation, writing direction, margins, page numbering, etc • To connect an XSLT style sheet to an XML document (client-side processing)<?xml-stylesheet type = "text/xsl" href = "XSLT style sheet"?> • An XSLT style sheet can specify page layout, page orientation, writing direction, margins, page numbering, etc

  7. Examples • greeting.xml, greeting.xsl and greeting.html

  8. Template matching • An XSLT style sheet is an XML document with a single element, stylesheet, which defines namespaces <xsl:stylesheet xmlns:xsl = “http://www.w3.org/1999/XSL/Format"> • If a style sheet matches the root element of the XML document, it is matched with the template: <xsl:template match = "/">

  9. XSLT basics • A template can match any element, just by naming it (in place of /) • XSLT elements include two different kinds of elements, those with content and those for which the content will be merged from the XML doc • Elements with content often represent HTML elements <span style = "font-size: 14"> Happy Easter! </span>

  10. XSLT basics • XSLT elements that represent HTML elements are simply copied to the merged document • The XSLT value-of element • Has no content • Uses a select attribute to specify part of the XML data to be merged into the XSLT document • <xsl:value-of select = ”CAR/ENGINE" /> • The value of select can be any branch of the document tree

More Related