我的DTD文件存在问题。我做了定义:
<definitions>
<availableGrades>
<gradeDefinition name="Role-Playing Game" id="RPG" />
<gradeDefinition name="First Person Shooter" id="FPS" />
<gradeDefinition name="Real Time Strategy" id="RTS" />
<gradeDefinition name="Racing" id="RAC" />
<gradeDefinition name="Sport" id="SPO" />
<gradeDefinition name="Third Person Perspective" id="TPP" />
<gradeDefinition name="Logic" id="LOG" />
<gradeDefinition name="Arcade" id="ARC" />
<gradeDefinition name="Strategy" id="STR" />
<gradeDefinition name="Platform" id="PLA" />
<gradeDefinition name="Adventure" id="ADV" />
<gradeDefinition name="Fighting" id="FIG" />
<gradeDefinition name="Simulator" id="SIM" />
<gradeDefinition name="Other" id="OTH" />
</availableGrades>
使用:
<game grade="FPS" />
在DTD中,我添加了IDREF:
<!ELEMENT gradeDefinition EMPTY>
<!ATTLIST gradeDefinition
name NMTOKENS #REQUIRED
id ID #REQUIRED>
<!ATTLIST game grade IDREF #REQUIRED>
我通过CSS显示成绩属性的值(内容:attr(成绩)),但在浏览器中我看到例如FPS。可以打印“First Person Shooter”而不是“FPS”(参考gradeDefinition名称)?