Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Adding a Bunch of Style: XSL Advantages

July 19, 1999

Are you wondering what is the point in bothering with XSL if you can use the much simpler CSS to render XML documents? There are several limitations in using CSS:

  • Rendering is dependent on the browser's support of CSS.
  • You can only assign styles to elements; attributes are completely ignored.
  • You can process each input element only once.
  • You can't add elements or other content to the output.
  • You can't do conditional processing.

XSL has none of these limitations, except the first. And that is the reason for excitement about XSL. XSL can transform its input into something very different for output, if so desired. In can be used to generate headers/footers, page numbering, sorting, filtering, and otherwise process the input. The advantages of XSL (XSLT and XSL-FO) include:

  • You don't need a browser; can use server side processing and deliver HTML to the client.
  • You can process elements, attributes, and content.
  • You can add elements and content to output.
  • You can sort or filter output; the result can be output in any language. (For example, you could generate compilable Java code based on XML content, as IBM has done.)
  • You can do conditional processing (decision and switch-like statements).
  • You can use canned or user-defined functions.
  • You can achieve complicated, desktop publishing page layouts and styles (eventually).

As was the case with referencing a CSS file, we simply add a reference to the XSL stylesheet after the prolog in the XML document:

<?xml-stylesheet type="text/xsl" href="collection2.xsl"?>

Note, however, that an XSL document is actually another XML document! It must follow the rules of well-formed XML. XSL also has its own complicated syntax which will be covered in detail in subsequent WDVL articles.

Viewing It With IE5 and Mozilla, Take 3 (CSS)
Doing It With XML, Part 2
Viewing It With IE5 and Mozilla, Take 4 (XSL)


Up to => Home / Authoring / Languages / XML / Tutorials / DoingIt




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers