Set the display mode of each tag in the XML document through the CSS style sheet.
Booklist.css
/** // * CSS Document */
Booklist {...}{
Display: block;
Margin: 2px;
Padding: 2px;
Width: 300px;
Border: 1px solid #000000;
Font: 12px georgia;
}
Book {...}{
Display: block;
Margin: 2px;
Padding: 2px;
Border: 1px solid #000000;
}
Name {...}{
Display: block;
Font-style: italic;
Font-weight: bold;
}
Price {...}{
Display: block;
Font-family: georgia;
}
Description {...}{
Display: block;
Font-size: 11px;
}
Publisher {...}{
Display: block;
Font-size: 11px;
}
Booklist. xml
Reference a CSS style sheet
<? Xml version = "1.0" encoding = "UTF-8"?>
<! DOCTYPE booklist [
<! ENTITY publisher "ABC company">
]>
<? Xml-stylesheet type = "text/css" href = "booklist.css"?>
<Booklist>
<Book>
<Name> Ajax </name>
<Price> $5.95 </price>
<Description> Foundations of Ajax. </description>
<Publisher> & publisher; </publisher>
</Book>
<Book>
<Name> Ajax Patterns </name>
<Price> $7.95 </price>
<Description> Introduction of Ajax Patterns. </description>
<Publisher> & publisher; </publisher>
</Book>
<Book>
<Name> Ajax Web App </name>
<Price> $8.95 </price>
<Description> Edition 2. </description>
<Publisher> & publisher; </publisher>
</Book>
<Book>
<Name> Core CSS </name>
<Price> $4.50 </price>
<Description> A book for CSS. </description>
<Publisher> & publisher; </publisher>
</Book>
<Book>
<Name> JSF and Ajax </name>
<Price> $6.95 </price>
<Description> Apress. </description>
<Publisher> & publisher; </publisher>
</Book>
</Booklist> running result: