Proceed to WirelessDevNet Home Page
Publications, e-books, and more! Community Tutorials Store Downloads, tools, & Freebies! IT Career Center News Home
newnav.gif

Newsletters
EMail Address:



   Content
  - Articles
  - Columns
  - Training
  - Library
  - Glossary
 
   Career Center
  - Career Center Home
  - View Jobs
  - Post A Job
  - Resumes/CVs
  - Resource Center
 
   Marketplace
  - Marketplace Home
  - Software Products
  - Wireless Market Data
  - Technical Books
 
   News
  - Daily News
  - Submit News
  - Events Calendar
  - Unsubscribe
  - Delivery Options
 
   Community
  - Discussion Boards
  - Mailing List
  - Mailing List Archives
 
   About Us
  - About WirelessDevNet
  - Wireless Source Disks
  - Partners
  - About MindSites Group
  - Advertising Information
 
INDEX
>Introduction
>Microsoft XML Parser Technology
>A Real-World Example
>Creating The Stylesheet
>Dissecting The Stylesheet

An Introduction to XSLT and XPath

A Real-World Example

I run some training courses for developers in Singapore and have a web site that contains information about all the courses available. There are a couple of different courses and I simply maintain them in plain text files although storing all these information in a database seems like a better idea. However, besides wanting my customers to view the site using a web browser, I also want my customers to be able to check the course information using a WAP device. This is an added convenience for people who wanted to quickly confirm the timing of the course as well as the course content.

The obvious choice for the markup language to use is XML. There is little motivation for me to code the pages in HTML, because by doing so I have to create another set of WML pages for WAP devices.

A typical course page looks like this:

<?xml version='1.0'?> <Course id="xmlxslt"> <Title>XML/XSLT - Extensible Markup Language & Extensible Stylesheet Language</Title> <Duration>16</Duration> <!--in hours--> <Synopsis>XML is the language used for describing data. With the advent of WAP, web sites developers are increasingly deploying their sites in XML and using the transformation engine of XSL, which is XSLT, to tailor their web pages to different browsers. Participants will be developing applications that can dynamically adapt to different browsers. </Synopsis> <Fees>800</Fees> <!--In S$ dollars--> <CourseDates> <Date> <Mode>Evenings</Mode> <Day>14</Day> <Month>10</Month> <Year>2000</Year> <Venue>Rock Tower</Venue> <Time> <From>1730</From> <To>2130</To> </Time> </Date> <Date> <Mode>Full Days</Mode> <Day>21</Day> <Month>10</Month> <Year>2000</Year> <Venue>Developers Unit</Venue> <Time> <From>0900</From> <To>1700</To> </Time> </Date> </CourseDates> </Course>

The XML document contains the following information:

  • Course title and synopsis
  • Cost of the course in S$ dollars
  • The timing of the course. You can have more than one run of a course.

If you load the XML document using Microsoft Internet Explorer 5 (IE5), you should see the following display:

Obviously we wouldn't want to let our customers see the XML document in its raw form (what IE5 did was to apply a default stylesheet to an XML document without any stylesheet specified). For customers using a web browser, we should display the course page using HTML. Let's see how we can do that.

Next: Creating The Stylesheet

Sponsors

Search

Eliminate irrelevant hits with our industry-specific search engine!









Wireless Developer Network - A MindSites Group Trade Community
Copyright© 2000-2010 MindSites Group / Privacy Policy
Send Comments to:
feedback@wirelessdevnet.com