13.07.2015 Views

Beginning CSS: Cascading Style Sheets for Web Design, 2nd ...

Beginning CSS: Cascading Style Sheets for Web Design, 2nd ...

Beginning CSS: Cascading Style Sheets for Web Design, 2nd ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 14: XMLThe inclusion of the encoding attribute is very important because the default encoding value is not“LATIN-1” but an even smaller set of characters. You must include the proper encoding type in orderto have all characters correctly translated to their proper display equivalents.The third attribute is the standalone attribute, which looks like this:The standalone attribute has to do with the inclusion of a Document Type Definition (discussed brieflyin Chapter 7). Document Type Definition (DTDs) may also be included in XML documents, but theyrequire the DTD to be custom written because the elements of an XML document can be invented.Creating a Document Type Declaration is beyond the scope of this book, so <strong>for</strong> the purpose of thisdiscussion the standalone attribute with a value of “yes” tells the browser that no Document TypeDeclaration is accompanying the XML document.An XML declaration should always be included in XML documents because it helpsboth humans and the computer program that is interpreting the XML to determinewhat kind of XML appears in the document.The pseudo-attributes of an XML declaration must also appear in a particular order: The first attributemust always be the version attribute, followed by the optional encoding attribute, followed by theoptional standalone attribute.The XML stylesheet DeclarationThe syntax <strong>for</strong> including a style sheet in an XML document closely resembles a cross between the XMLdeclaration itself and the tag in HTML/XHTML:Like the element in an HTML or XHTML document, this references the external style sheet,which styles the XML document. The XML stylesheet declaration must appear after the XML declaration.The declaration must appear first in the document and be<strong>for</strong>e the document markup itself. Byincluding a style sheet, you gain access to the full range of <strong>CSS</strong> properties and values in an XML document,just as you gain access in an HTML or XHTML document.Now that you are familiar with the XML declaration and the stylesheet declaration, you can appendthe syntax to the My Favorite Records example shown in Figure 14-3a.This results in the output depicted in Figure 14-3b.I’ll be using the My Favorite Records example again later in the chapter, but <strong>for</strong> now just put it aside.511

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!