XSLT What Is It and Why Use It










- Slides: 10
XSLT: What Is It and Why Use It? Nikki Massaro Kauffman http: //www. personal. psu. edu/lnm 105
What do we know about CSS (Cascading Style. Sheets)? • CSS allows us to separate content from presentation (to some degree). • Content lives in an HTML page. • Styles are defined in a separate CSS file. HTML CSS Content
XSLT is e. Xtensible Stylesheet Language Transformations. • It separates data from formatting. • Data lives as XML. • Formatting defined by XSL. • Resulting XHTML viewed in the browser. XML Data XSL XHTML
What is Client-Side XSLT? • XHTML Page references XSL and XML documents. • Transformation is done by browser. • XSL can be cached and reused. Only XML data is downloaded with each request. • XML data is faster to download than XHTML page.
What is Server-Side XSLT? • Transformation happens on the server, so browser only ever accesses the resulting XHTML. • Results are consistent across browsers. • XSLT can be used to present data in a number of file formats…
Why use XSLT? XSLT allows you to take the same XML data set and apply different… • Filters • Presentations • Formats … depending on your audience.
Why use XSLT? Filters XSLT allows you to filter and sort the XML data for the needs of the various audiences: • Use same XML for page data. • Use multiple XSL templates based on audience.
Why use XSLT? Presentations XSLT can be used to take the separation of content and presentation further than CSS: • Use XML for page data. • Use CSS for Styles. • Use XSL to build an XHTML page that links to CSS and that creates the divs identified in the CSS.
Why use XSLT? Formats The same XML source data can be transformed into multiple file formats using XSL templates. . .
Creative Uses of XSLT • Customizable CSS files. • Custom DWT files (Dreamweaver templates) • Automated. htaccess and. htgroup files.