Duration: 2 Days
This class builds on your basic XML knowledge and focuses on creating modular and flexible style sheets. You'll examine the complexities of style sheets, such as XPath, functions, modes, and dynamic modification, with many examples and exercises. This is the perfect class for mastering the techniques required to transform your XML data into the various formats your applications demand.
What You Will Learn
- Parse documents sequentially
- Work with XPath axes and expressions
- Utilize functions and calculations in style sheets
- Write reusable XSL style sheets
- Modes and named templates
- Produce output in multiple formats
- Dynamically modify style sheets
- Perform dynamic searches with XSL
Audience
Web development professionals who would like to learn how to program using XML
Prerequistes
- Introduction to XML (course 1830) and/or significant experience using XML and XSLT
- Basic familiarity with JavaScript
Course Outline
1. Introduction to XSLT
- Where does XSLT fit in?
- Goals of the course
2. Review: Processing an XML Datasheet with XSL
- An analysis of the XSLT code
- Variables in XSL and the xsl:variable tag
3. Using XSL to parse documents sequentially
- Mixed-content elements in XSL
- Transforming an XML sonnet for display
- Producing combination-type XSL style sheets
- Adding a section of footnotes to your sonnet
4. Numbering with xsl:number
- The <xsl:number> tag
- Referencing line numbers in your sonnet
5. XPath Axes and Expressions
- Using axis expressions to specify relationships
- Selecting and sorting parent elements by a child node
6. Functions and Calculations
- Common XSL functions
- Arithmetic in XSL
- Adding functions and arithmetic to your book report
- Number formatting
- Adding formatting to the numbers in your book report
- Measuring node position
- Applying code appropriately based on node position
7. Writing Reusable Code
- Named templates
- Creating and referencing a named template
8. Modes: Applying Different Templates to Nodes with the Same Name
- Beginning a table of contents
- Generating unique identifiers for internal hyperlinks
- Generating unique identifiers for the table of contents
9. Producing Output in Multiple Formats
- Producing plain text with XSL
- Using template recursion to produce content
- Generating a sonnet in plain text
- Producing new XML
- Rebuilding the XML of your book list
- Reusable conversion templates
- Making exceptions in your template rules
- Making your conversion code portable
10. Dynamic Modification of XSL
- Generating data drill-downs
- Adding a drill-down for book information
- Displaying more information without losing your list of links
- Creating scrollable displays
- Allowing users to page through a display of books
- Dynamic searching with XSL
- Allowing users to search your list of books
11. Including External Code Libraries
- xsl:import vs. xsl:include
- Case-insensitive searching
- Making a case-insensitive search that uses an external library
12. Introduction to the XML DOM
- Partial searches with JavaScript
- Building a tree display of your XML content
Course Labs