Elements and Attributes << Adding Some Style >> XSLT Basics
Normal CSS stylesheets may be used to control the display formatting of the information in an XML document. Here is a very simplified style sheet to use on our example...

title, age_group ,comments {display:block;}
title {font-size:14px; color:#f00; text-decoration:underline;}

The first line will make the contents of each element display in block formation. (it will take up the full line and put the next bit of information on the next full line).

The second line will format the information found within the title tags.

Saving that snippit as "example.css" we can then attach it to the XML example coding...

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/css" href="example.css"?>
         <title> Finding Nemo </title>
         <age_group> Kids </age_group>
         <comments> Fish are friends, not food. </comments>

         <title> Monty Python Holy Grail </title>
         <age_group> Adult </age_group>
         <comments> A shrubbery for the Knights who say Nee! </comments>

         <title> Harry Potter </title>
         <age_group> All </age_group>
         <comments> Very popular for all ages. </comments>

Now that there is some formatting applied to the XML page, it will actually display the data only instead of all of the raw tags.

XML Example 2

This example wont win any great awards, but it does its job by showing the example in action :)

XSL and XSLT is used to format an XML document correctly. CSS is good for HTML coding, but XSL will take our XML document to a much higher level of formatting.
Elements and Attributes << Adding Some Style >> XSLT Basics

Advertise in the banner along the top, Click here!

Valid XHTML 1.0 Transitional Valid CSS! Text Link Ads