Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Analyze with XSLT, Part 1: Analyze non-XML data with XSLT

Create string parsing routines to convert documents into XML elements

Chuck White (chuck@tumeric.net), XSLT consultant and Web engineer, Freelance Developer
Chuck White, a Studio B author, has been working with XML since before its official inception in February, 1998. He was co-author of Mastering XML Premium Edition (with Linda Burman and the W3C's XML Activity Lead, Liam Quin) and author of Mastering XSLT, both from Sybex Books. His latest books are Developing Killer Web Apps with Dreamweaver MX & C# (also for Sybex Books) and HTML, XHTML, and CSS Bible, 3rd Edition for Wiley, for which he is co-author with Steve Schafer. Chuck is currently working with the XSL Team at eBay as a project consultant and Web engineer.

Summary:  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.

View more content in this series

Date:  16 Dec 2003
Level:  Introductory PDF:  A4 and Letter (106 KB | 28 pages)Get Adobe® Reader®

Activity:  6417 views
Comments:  

Resources

  • Check out the rest of this developerWorks tutorial series on XSLT for more information on advanced uses for XSL transformations:
  • Don't know XSLT? Better try the IBM Tutorial on beginning XSLT (http://www.ibm.com/developerworks/edu/x-dw-xwebxslt-i.html) (developerWorks March 2003).

  • Get information- on UTF-8 and Unicode, two important pieces of the XML puzzle (http://www.cl.cam.ac.uk/~mgk25/unicode.html).

  • To work with XML, you need an XML parser. Check out this list of XML parsers (http://xml.coverpages.org/publicSW.html#xmlToolsTOC).

  • It isn't possible to process XSLT documents without an XSLT processor. Browse this list for some of the more common XSLT Processors (http://www.xml.com/pub/a/2001/03/28/xsltmark/results.html).

  • Check out Mastering XSLT (http://www.amazon.com/exec/obidos/tg/detail/-/0782140947/103-5714425-8867848?v=glance) by this author.

  • Read about EXSLT (http://www.exslt.org), a community initiative to provide extensions to XSLT. While you're at it, check out Uche Ogbuji's article "EXSLT by example" (http://www.ibm.com/developerworks/library/x-exslt.html), which uses practical examples to introduce and demonstrate some useful EXSLT functions (developerWorks, February 2003).

  • Learn more about OpenOffice (http://www.openoffice.org/), an office suite that runs on all major platforms and provides access to all functionality and data through open-component based APIs and an XML-based file format. Uche Ogbuji also discusses OpenOffice in his Thinking XML column (http://www.ibm.com/developerworks/xml/library/x-think15/) (developerWorks, January 2003).

  • You can opt to run the initial example in this tutorial using a Perl interpreter (http://ftp.linux.cz/pub/perl/ports/).

  • You don't have to pay gobs of money for an XML editor. Try this list of free XML editors (http://www.garshol.priv.no/download/xmltools/cat_ix.html#SC_XMLEditors).

  • Learn more about regular expressions in Mark-Jason Dominus' article "How Regexes Work" which demonstrates how to write a regular expression package from scratch (http://perl.plover.com/Regex/article.html).

  • Don't know XML? Well, here's the XML specification (http://www.w3.org/XML/). You can also check out Doug Tidwell's "Introduction to XML" tutorial (http://www.ibm.com/developerworks/edu/x-dw-xmlintro-i.html) here on developerWorks (August 2002).

  • You should always keep a bookmark to the current specifications. Here's the XSLT 1.0 spec (http://www.w3.org/TR/xslt), and you can view the current status of XSLT 2.0 (http://www.w3.org/TR/xslt20/).

  • Visit this earlier article by the author for an early "Peek Into the Future of XSLT 2.0" (http://www.devx.com/xml/Article/11147). Note that some of the technical stuff may have changed.

  • How Michael Kay manages to get as much done as he does is beyond me. He not only is the editor of the upcoming XSLT 2.0 specification, but cranks out a pretty good XSLT processor, Saxon XSLT editor (http://saxon.sourceforge.net/), which you'll need if you want to develop XSLT 2.0 applications before the final spec is released.

  • The Apache Group, developers of the famous Apache Web Server, has an extensive XML development program. Visit the Apache XML Project (http://xml.apache.org/), which includes some very interesting XSLT involving multiple documents using a process they call "piping".

  • Take a look at this list of Perl interpreters (http://ftp.linux.cz/pub/perl/ports/).

  • If you're just desperate to try grouping, or simply need to use grouping to complete a project, visit the section of the XSL FAQ hosted by Dave Pawson on Muenchian techniques (http://www.dpawson.co.uk/xsl/sect2/muench.html#d7739e13).

  • Learn how XSL transformations can be used with WebSphere Application Server in "XSL Transform Basics with WebSphere Application Server Version 4.0x" by Joel Sundman (http://www.ibm.com/developerworks/websphere/techjournal/0204_sundman/sundman.html) (developerWorks, April 2002).

  • Browse for books on these and other technical topics.

  • Finally, find out how you can become an IBM Certified Developer in XML and related technologies.

11 of 12 | Previous | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=XML
ArticleID=138216
TutorialTitle=Analyze with XSLT, Part 1: Analyze non-XML data with XSLT
publish-date=12162003
author1-email=chuck@tumeric.net
author1-email-cc=dwxed@us.ibm.com

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.