<<
Home , XSL

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

Title,Author,Category

4 Example 1: Generating CSV File Using XSLT

"", "","( Fiction Science Computing Crime Unclassified )“ 5 Example1-Output: 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

x00ffff

7 Example 2: Generating Nicely Formatted HTML Using XSLT cont’d

<xsl:value-of select="$title"/>

A complete list of books, grouped by author

AUTHOR: ( of )

8 Example 2: Generating Nicely Formatted HTML Using XSLT cont’d
TITLE:
CATEGORY: ()

9 Example 2: Generating Nicely Formatted HTML Using XSLT

10 XSL Programming Tips

Ø Try this out: java -cp /u/csc309h/lib/saxon.jar com.icl.saxon.StyleSheet books. books.xsl > books.

ØCode Style: ØUse Good Indentation ØBe Explicit, e.g. do not write blahblahblah but instead write blahblahblah

11 Sites:

Ø http://www.xslinfo.com

Ø http://www.mulberrytech.com/xsl/xsl-list

12