我发现了非常相似的问题,但是没有答案。我准备了简单的结构:XML和DTD文件,其中b_id表示id。是否可以使用CSS在书中获取和打印作者值?
<!ELEMENT books (book+, authors)>
<!ELEMENT book (title?, book_author?)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT book_author (#PCDATA)>
<!-- ????? -->
<!ATTLIST book_author b_id IDREF #REQUIRED>
<!ELEMENT authors (author+)>
<!ELEMENT author (name, surrname)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT surrname (#PCDATA)>
<!ATTLIST author id ID #REQUIRED>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE books SYSTEM "dtd.dtd">
<?xml-stylesheet href="style.css" type="text/css"?>
<books>
<book>
<title>
Sample Title
</title>
<book_author b_id="1">
<!-- Author data -->
</book_author>
</book>
<authors>
<author id="1">
<name>
Name
</name>
<surrname>
Surrname
</surrname>
</author>
</authors>
</books>