 | Level: Introductory Chuck White (chuck@tumeric.net), XSLT consultant and Web engineer, Consultant
16 Dec 2003 This tutorial explores how to create string parsing routines in XSLT so that you can tokenize straight, non-XML text, thus turning that text into a series of XML elements. Specifically, this tutorial examines how to convert such documents as weblogs and Web configuration files into XML for improved readability and programmatic access.
Prerequisites
This tutorial is the first of multi-part series that details the benefits of using XSL Transformations (XSLT) through a fictional example. Developers should have a basic understanding of XML and be familiar with basic XSLT tasks. The more knowledge you have of XSLT, the better, but you should be able to follow the tutorial with a less than intermediate-level knowledge of XSLT. In addition, you'll find the last section on regular expressions using XSLT 2.0 easier to follow if you have some background in regular expressions, but experience with regular expressions isn't a prerequisite for successfully completing the tutorial. Other tutorials in this series are:
System requirements
You'll need JavaScript enabled in your browser. You'll need JavaScript enabled in your browser. Install and test the following tools before beginning the tutorial:
-
An XML parser (http://xml.coverpages.org/publicSW.html#xmlToolsTOC) and an XSLT processor (http://www.xml.com/pub/a/2001/03/28/xsltmark/results.html. This tutorial assumes you have and know how to use each of these.
- A text editor that supports UTF-8 (http://www.cl.cam.ac.uk/~mgk25/unicode.html) or an XML editor (http://www.garshol.priv.no/download/xmltools/cat_ix.html#SC_XMLEditors)
- For XSLT 2.0 examples, Saxon (http://saxon.sourceforge.net/), an XSLT 2.0-compliant processor (http://www.w3.org/TR/xslt20/).
- Optionally, a Perl interpreter (http://ftp.linux.cz/pub/perl/ports/") for running the initial example.
- Download the file, x-dataxsltsourcecode.zip, before you start the tutorial so you can follow along more easily. The tutorial contains code fragments. The zip file contains complete code examples and you can view the code fragments from the context of the overall file.
Duration
Under one hour
Formats html, pdf
|  | |  |