Modify the XSLT style sheet of Exercise 7.9 so that it formats all the patient elements in the XML document of Exercise 7.7, and use the style sheet to create a display of the whole document.
Solution
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<?xml-stylesheet type=\"text/css\" href=\"cars.css\"?>
<Cars>
<Car>
<make></make>
<model></model>
<year></year>
<color></color>
<engine>
<number_of_cylinders></number_of_cylinders>
<fuel_system></fuel_system>
</engine>
<number_of_doors></number_of_doors>
<transmission_type></transmission_type>
<accessories>
<radio></radio>
<air_conditioning></air_conditioning>
<power_windows></power_windows>
<power_steering></power_steering>
</accessories>
</Car>
</Cars>
----------------------------------------------------------------------
CSS file:
-------------
Cars {
background-color: #ffffff;
width: 100%;
}
Car {
display: block;
margin-bottom: 30pt;
margin-left: 0;
}
engine {
display: block;
color: #ff0000;
font-size: 20pt;
}
accessories {
display: block;
color: #0000ff;
font-size: 20pt;
}
make, year, model, color, number_of_doors, number_of_cylinders, radio, air_conditioning, power_steering, power_windows, transmission_type {
display: block;
color: #000000;
margin-left: 20pt;
}
.