Programming on the Web(CSC309F)
Tutorial 2: XSL & XSLT TA:Wael Abouelsaadat
WebSite: http://www.cs.toronto.edu/~wael
1 XML and XSL Combined
XML Document XSL Tree XML Application/Tree /
XML Parser XSL Parser DTD Document
XSL Document
HTML Document
2 XSL: An Example Oriented Programming Language
Ø XSL or XSLT?
Ø What is an Example Oriented Programming Language?
ØMain features of XSLT: § 50 formatting element types, 230 properties! § Template driven (vs function driven) § Full fledged programming language( loops, switch/case, variables,…) but not a general purpose one….
3 Example 1: Generating CSV File Using XSLT
4 Example 1: Generating CSV File Using XSLT
books.csv
Title,Author,Category "Number, the Language of Science","Danzig","S(Science)" "Tales of Grandpa Cat","Wardlaw, Lee","F(Fiction)" "Learn Java Now","Stephen R. Davis","C(Computing)" "Design Patterns","Erich Gamma, Richard Helm,JohnVlissides",“C(Computing)"
6 XSL-Example 2: Generating Nicely Formatted HTML Using XSLT
7 Example 2: Generating Nicely Formatted HTML Using XSLT cont’d
A complete list of books, grouped by author
AUTHOR:
8 Example 2: Generating Nicely Formatted HTML Using XSLT cont’d
TITLE:
CATEGORY:
10 XSL Programming Tips
Ø Try this out: java -cp /u/csc309h/lib/saxon.jar com.icl.saxon.StyleSheet books.xml books.xsl > books.html
ØCode Style: ØUse Good Indentation ØBe Explicit, e.g. do not write blahblahblah
11 Sites:
Ø http://www.xslinfo.com
Ø http://www.mulberrytech.com/xsl/xsl-list
12