Click here to Skip to main content
15,393,377 members
Articles / Web Development / CSS
Tip/Trick
Posted 19 Mar 2012

Tagged as

Stats

11.9K views
1 bookmarked

Connect an External Stylesheet to XML

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
19 Mar 2012CPOL
How to connect an external stylesheet to XML.

Introduction

In this short how to, I will demonstrate how to connect an external stylesheet to your XML. First I will show what the XML code looks like, this will call in the stylesheet. Next I will show you a sample of the CSS file.

Using the code

First we we need to create the XML file, below is a sample:

XML
<?xml version="1.0? encoding="ISO-8859-1??>
<car>
<vauxhall>
<model>corsa
<engine>1.0</engine>
<colour>red</colour>
</model></vauxhall>
</car>

Next, we will create the CSS file, below is a sample, the file is called mycssfile.css.

CSS
/****************** mycssfile.css **************/

@charset "utf-8?;
/* CSS Document */
car,vauxhall
{
font-family:"arial, helevtica;
}
model
{
display:block;
font-size:18px;
color:#C69;
}
engine,colour
{
display:block;
}

Notice that the following line of code in your XML file is used to call the stylesheet.

The XML was created and validated using Liquid XML Editor.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

tomjoly45
United States United States
No Biography provided

Comments and Discussions

 
QuestionThe line to add to the XML?? Pin
Matt T Heffron20-Mar-12 7:25
professionalMatt T Heffron20-Mar-12 7:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.