Presentation is loading. Please wait.

Presentation is loading. Please wait.

XSLT 1. C ONTENTS XSLT and uses XSLT example Simple XML How XSLT works? Template-match Value-of For-each and sort If Choose-when Apply-templates Where.

Similar presentations


Presentation on theme: "XSLT 1. C ONTENTS XSLT and uses XSLT example Simple XML How XSLT works? Template-match Value-of For-each and sort If Choose-when Apply-templates Where."— Presentation transcript:

1 XSLT 1

2 C ONTENTS XSLT and uses XSLT example Simple XML How XSLT works? Template-match Value-of For-each and sort If Choose-when Apply-templates Where XSLT can be used? 2

3 XSLT AND U SES XSLT stands for Extensible Stylesheet Language Transformations. XSLT is designed for use as part of XSL, which is a stylesheet language for XML - Transforms one XML to another XML or other text such as HTML Advantages: o Easy to merge data into XML data into a presentation o XSLT, when used in websites, allow strict separation between HTML and code-behind. o We use XSLT extensively for things like documentation, and making some complex configuration settings user-serviceable 3

4 XSLT EXAMPLE 4

5 S AMPLE XML Mozart Austrian Beethoven German Bach German Specify XSL for display 5

6 S AMPLE XSL Authors Composers from Austria Name XSL version XPath 6

7 P UTTING IT TOGETHER The XSL was: The chooses the root The is written to the output file The contents of message is written to the output file The is written to the output file The resultant file looks like: Hiiii 7

8 H OW XSLT WORKS The XML text document is read in and stored as a tree of nodes The template is used to select the entire tree The rules within the template are applied to the matching nodes, thus changing the structure of the XML tree Unmatched parts of the XML tree are not changed After the template is applied, the tree is written out again as a text document 8

9 T EMPLATE MATCH My CD Collection Title Artist 9

10 V ALUE - OF Title Artist 10

11 F OR - EACH AND SORT Title Artist 11

12 IF Title Artist 12

13 C HOOSE WHEN Title Artist 13

14 A PPLY - TEMPLATES My CD Collection Title: Artist: 14

15 W HERE XSLT CAN BE USED With an appropriate program, such as Xerces, XSLT can be used to read and write files A server can use XSLT to change XML files into HTML files before sending them to the client A modern browser can use XSLT to change XML into HTML on the client side Some applications which store data in XML use XSLT to present this data in a human-readable format. For example, Windows Live Messenger stores the trace of messages as XML, but when you open the history in WLM itself, it shows you a pretty table which in fact is HTML built through XSLTWindows Live Messenger 15

16 THANK YOU 16


Download ppt "XSLT 1. C ONTENTS XSLT and uses XSLT example Simple XML How XSLT works? Template-match Value-of For-each and sort If Choose-when Apply-templates Where."

Similar presentations


Ads by Google