Introduction to XSLT
Upcoming SlideShare
Loading in...5
×
 

Introduction to XSLT

on

  • 399 views

Introduction to XSLT by introducting XML,XHTML. XPath, XSL

Introduction to XSLT by introducting XML,XHTML. XPath, XSL

Statistics

Views

Total Views
399
Views on SlideShare
398
Embed Views
1

Actions

Likes
0
Downloads
7
Comments
0

1 Embed 1

http://www.slashdocs.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • A "Valid" XML document is a "Well Formed" XML document, which also conforms to the rules of a Document Type Definition (DTD):The purpose of a DTD is to define the structure of an XML document. It defines the structure with a list of legal elements:
  • XHTML is almost identical to HTML 4.01XHTML is a stricter and cleaner version of HTMLXHTML is HTML defined as an XML applicationXHTML is a W3C Recommendation of January 2000.XHTML is supported by all major browsers.XHTML elements must be properly nestedXHTML elements must always be closedXHTML elements must be in lowercaseXHTML documents must have one root element
  • An XSL style sheet is, like with CSS, a file that describes how to display an XML document of a given type.
  • In addition, XPath may be used to compute values (e.g., strings, numbers, or Boolean values) from the content of an XML document
  • XSLT :Originally intended to perform complex styling operations, like the generation of tables of contents and indexes, it is now used as a general purpose XML processing language. XSLT is thus widely used for purposes other than XSL, like generating HTML web pages from XML data.
  • An XSL style sheet consists of one or more set of rules that are called templates.A template contains rules to apply when a specified node is matched

Introduction to XSLT Introduction to XSLT Presentation Transcript

  • Introduction to XSLT
  •  XML  XML Namespaces  HTML  XHTML  XSL  XPath  XSLT : What it do ? How it do it?  XSLT :Demo - example  Q&A2 HP Restricted HP Restricted 1/1/2013 2
  •  XML stands for eXtensible Markup Language eXtensible which means that tags are not predefined Extensible means that there is no fixed tag set (like in HTML) Markup Language : is a set of markup tags. XML was created to structure, store, and transport information. XML is designed to be self-descriptive
  •  A "Well Formed" XML document has correct XML syntax.The syntax rules are :  XML documents must have a root element  XML elements must have a closing tag  XML tags are case sensitive  XML elements must be properly nested  XML attribute values must be quoted
  • Name Conflicts  In XML, element names are defined by the developer. This often results in a conflict when trying to mix XML documents from different XML applications.  This XML carries HTML table information:<table> <tr> <td>Apples</td> <td>Bananas</td> </tr></table>  This XML carries information about a table (a piece of furniture):<table> <name>African Coffee Table</name> <width>80</width> <length>120</length></table>
  •  <h:table> <h:tr> <h:td>Apples</h:td> <h:td>Bananas</h:td> </h:tr> </h:table> <f:table> <f:name>African Coffee Table</f:name> <f:width>80</f:width> <f:length>120</f:length> </f:table>
  •  <root xmlns:h="http://www.w3.org/TR/html4/" xmlns:f="http://www.w3schools.com/furniture"> <h:table> <h:tr> <h:td>Apples</h:td> <h:td>Bananas</h:td> </h:tr> </h:table> <f:table> <f:name>African Coffee Table</f:name> <f:width>80</f:width> <f:length>120</f:length> </f:table> </root>
  •  Defining a default namespace for an element saves us from using prefixes in all the child elements. It has the following syntax:xmlns="namespaceURI“This XML carries information about a piece offurniture:<table xmlns="http://www.w3.org/TR/html4/"> <tr> <td>Apples</td> <td>Bananas</td> </tr></table>
  •  HTML stands for Hyper Text Markup Language HTML is not a programming language, it is a markup language The tags of HTML is predefined markup tags
  •  XHTML stands for EXtensible HyperText Markup Language Well formed HTML
  •  XSL stands for EXtensible Stylesheet Language.  XSL = Style Sheets for XMLXSL describes how the XMLdocument should be displayed!
  •  Styling is both about transforming and formatting information. When the World Wide Web Consortium (W3C) made their first XSL Working Draft, it contained the language syntax for both transforming and formatting XML documents. Later, the Working Group at W3C split the original draft into separate Recommendations: * XSLT, a language for transforming XML documents * XSL-FO, a language for formatting XML documents * XPath, a language for navigating in XML documents
  •  XPath, the XML Path Language, is a query language for selecting nodes from an XML document. The XPath language is based on a tree representation of the XML document, and provides the ability to navigate around the tree, selecting nodes by a variety of criteria
  •  XSLT is used to transform an XML document into another XML document, or another type of document that is recognized by a browser, like HTML and XHTML. Normally XSLT does this by transforming each XML element into an (X)HTML element.
  •  In the transformation process, XSLT uses XPath to define parts of the source document that should match one or more predefined templates. When a match is found, XSLT will transform the matching part of the source document into the result document.
  •  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Tra nsform">
  •  The <xsl:template> Element The <xsl:template> element is used to build templates. The match attribute is used to associate a template with an XML element. The match attribute can also be used to define a template for the entire XML document. The value of the match attribute is an XPath expression (i.e. match="/" defines the whole document). <xsl:template match="/"> ----------</ xsl:template >