跳轉到內容

XML - 資料交換管理/CSS/答案

來自華夏公益教科書,開放書籍,開放世界

以下是一種方法

為了將外部樣式表與 XML 文件連線起來,您需要編寫以下程式碼:
<?xml-stylesheet type="text/css" href="excercise1.css"?>
將其放在文件開頭,位於以下程式碼之下:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

如下所示

<?xml version="1.0" encoding="UTF-8"  standalone="yes"?>
<?xml-stylesheet type="text/css" href="exercise1.css"?>
<!DOCTYPE inventory[
  <!ELEMENT inventory (book+)>
  <!ELEMENT book (isbn,title,titel?,author+,publisher,price)>
  <!ELEMENT isbn (#PCDATA)>
  <!ELEMENT title (#PCDATA)>
  <!ELEMENT author (#PCDATA)>
  <!ELEMENT publisher (#PCDATA)>
  <!ELEMENT price (#PCDATA)> 
  <!ENTITY gyl "Gylden, Oslo Norway">    <!-- example of publisher -->
  <!ENTITY sybex "SYBEX Inc. San Francisco California"> <!-- example of publisher -->
]>

<inventory>
 <book>
  <isbn>91-1-300875-7</isbn>
  <title>Here you put in a title</title>
  <author>Here you put in a author</author>
  <publisher>&gyl;</publisher>
  <price>$30</price>
 </book>
 <book> 
  <isbn>91-2-705229-X</isbn>
  <title>Title of second book</title>
  <author>Author of second book </author>
  <publisher>&sybex;</publisher>
  <price>$30</price>
 </book>
</inventory>
華夏公益教科書