跳到內容

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>
華夏公益教科書