O'Reilly logo

Sams Teach Yourself XML in 10 Minutes by Andrew H. Watt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Some Examples Using CSS Styling

If your XML data is structured as you want to display it, you can effectively use CSS to display XML content.

Listing 13.1 shows a CSS style sheet to display heading information in red and paragraph text in a smaller, black font.

Listing 13.1. Reports.css: A CSS Style Sheet to Display Reports Stored in XML
header{font-family:Arial, sans-serif; 
         font-size:18; 
         color:blue;} 
content{ {font-family:"Times New Roman", serif; 
         font-size:12; 
          color:black;} 

The XML source document is shown in Listing 13.2.

Listing 13.2. Reports.xml: A Brief XML Data Store of Reports
 <?xml version='1.0'?> <?xml-stylesheet href="Reports.css" type="text/css" ?> <Reports> <Report> <header>Some interesting report</header> <content>Some fascinating ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required