You are on page 1of 5

Priyankar Paul 1

29SCS124

Ex. No: 10
SIMPLE XML PAGE
16/03/2011 USING CSS

Aim:
To design a XML page using cascading style sheets.

Description:
Cascading style sheet

 Create a separate style sheet file

 This is the best method if you wish to control the design of more than one page.

 The style definitions are only written once and saved into a file. Each page that wishes
to use that file places a link to the file in the HEAD section.

Syntax

Place the following link into the <head> section of your page, use the name you have selected
for the CSS file in place of yourStyleFileName.css

<?xml version="1.0" encoding="ISO-8859-1"?>

<?xml-stylesheet type="text/css" href=" yourStyleFileName.css "?>

CSS External File

CSS files are ordinary text files and can be written in a simple text editor such as notepad.
The file must be given the extension .css
Priyankar Paul 2
29SCS124

Program:

Main page (index.xml)

<?xml version="1.0"?>

<?xml-stylesheet type="text/css" href="aa.css"?>

<PCSuites>

<Content> Company </Content>

<Company>

<Title>nokia.xml complete reference</Title>

<Author>heather williamson</Author>

<Publication>R and G publications</Publication>

<Cost>Rs.200</Cost>

</Company>

<Company>

<Title>samsung.xml complete reference</Title>

<Author>sam john</Author>

<Publication>tata publications</Publication>

<Cost>Rs.250</Cost>

</Company>

</PCSuites>

Style Sheet (style.css)

Content
{
font-family: "Comic Sans MS"
color: blue;
text-align: Center;
Priyankar Paul 3
29SCS124

width: 50%;
font-size: 30pt;
text-transform: uppercase;
line-height: 200%
}

Company
{
color: purple;
margin-left: 10pt;
text-indent: 5em;
}

Title
{
display: block;
color: green;
margin-left: 10pt;
text-transform: capitalize;
line-height: 200%;
}

Author
{
display: block;
color: red;
margin-left: 50pt;
text-transform: capitalize;
line-height: 200%;
}

Publication
{
display: block;
color: red;
margin-left: 50pt;
text-transform: capitalize;
line-height: 200%;
}

Cost
{
display: block;
Priyankar Paul 4
29SCS124

color: red;
margin-left: 50pt;
text-transform: captialize;
line-height: 200%;
}
Priyankar Paul 5
29SCS124

Output:

Result:

Thus the XML program using cascading style sheets was executed and its output was
verified.

You might also like