XSLT and XPath Seminar

by Boris Gedat

Practical introduction to XSLT and XPath programming

In this training you will learn how to extract informations from XML-Files with XSLT and XPath and how to create result documents in the form of text, XML or HTML. This training is a practical course. Many exercises are waiting to be developed.

Duration:
ca. 16 training units à 45 minutes

Target audience:
programmers, translators, technical writers

Prerequisites:
basic computer skills, basic XML knowledge would be useful

Introduction:

  • What is XSLT and XPath?
  • What is the difference between XSL and XSLT?
  • The transformation model of XSLT
  • Using the Saxon processor on the command line

Preparing Eclipse:

  • Configuring the path to the XSLT schema
  • Importing templates
  • Creating a new XSLT file

Output formats

  • Controlling whitespace with xsl:text and entities
  • The different output formats
  • HTML Mode
  • Generating XHTML documents
  • Namespaces for the stylesheet
  • Whitespace in the source document

Principles

  • Element types
  • Template types
  • Build-in Templates
  • The XSLT 2.0 transformation model
  • Creating nodes

XPath

  • What are sequences?
  • Schema data types
  • XPath expressions
  • XPath axes
  • Operators in XPath 2.0 expressions
  • Node test

Control structures

  • The xsl:if element
  • The xsl:choose element
  • Conditions in XPath expressions
  • Loops in XPath and XSLT

Variables and Parameters

  • Content of variables
  • Data types of variables
  • Visibility levels of XSLT 2.0 variables
  • Parameters
  • Passing external parameters

Numbering and grouping

  • Numbering with xsl:number
  • Sorting with xsl:sort
  • Grouping with xsl:for-each-group

Functions

  • String processing
  • Substring matching
  • Pattern matching
  • Context and aggregate functions
  • Date and time
  • Formatting numbers
  • Defining our own functions

External documents

  • Importing external stylesheets
  • Including external stylesheets
  • Processing external documents
  • Generating multiple result documents

Extending XSLT

  • Configuring Eclipse
  • The principle behind the extension mechanism
  • Calling Java from XSLT