XML CSS

CSS is Cascading Style Sheet. It is used to add style and display information to an XML document. It can be format whole XML document. The XML document styled using CSS. How to link XML file with CSS. Syntax

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

XML CSS Example

Here is CSS file cssstudent.css
student  
{  
Background-color: blue;  
}  
name,class,section  
{  
font-size:30px;  
display:block;  
color: orange;  
margin-left: 60px;  
}
Create DTD file. student.dtd
<!ELEMENT student (name, class, section)>  
<!ELEMENT name(#PCDATA)>  
<!ELEMENT class(#PCDATA)>  
<!ELEMENT section(#PCDATA)>
Let's see xml file using CSS and DTD. student.xml
<?xml version=?1.0??>  
<?xml-stylesheet type=?text/css? href=?cssstudent.css??>  
<!DOCTYPE student SYSTEM ?student.dtd?>  
<student>  
    <name>Ajay singh</name>  
    <class>10</class>  
    <section>B</section>  
 </student>



ADVERTISEMENT
ADVERTISEMENT