我的 DTD 和 XML:
<!DOCTYPE test [
<!ELEMENT team(owner+)>
<!ATTLIST team
name ID #REQUIRED
coach IDREF #REQUIRED
>
<!ELEMENT owner (#PCDATA)>
<!ELEMENT coach EMPTY>
<!ATTLIST coach
name ID #REQUIRED
>
<!ELEMENT game EMPTY>
<!ATTLIST game
teams IDREFS #REQUIRED
winner IDREF #REQUIRED
>
<!ELEMENT db (coach*,team*,match*)>
]>
<?xml version="1.0" ?>
<db>
<team name = "Hapoel" coach = "Abuksis">
<owner> Eli Tabib</owner>
</team>
<team name = "Maccabi" coach = "Blat">
<owner> Shimi</owner>
<owner> Federman</owner>
</team>
<team name = "Beitar" coach = "Eli Cohen">
<owner> Arkadi</owner>
</team>
<team name = "ElitzorLavi" coach = "Eli">
<owner> Zehava</owner>
<owner> Dani</owner>
</team>
<coach name = "Abuksis"/>
<coach name = "Eli Cohen"/>
<coach name = "Blat"/>
<coach name = "Eli"/>
<game teams = "Hapoel" winner = "Maccabi"/>
<game teams = "Hapoel Beitar" winner = "Beitar"/>
<game teams = "Maccabi ElitzorLavi" winner = "Maccabi"/>
<game teams = "Elitzor Lavi Maccabi" winner = "Maccabi"/>
</db>
我必须找到球队数量小于 2 的比赛,现在我希望只获得第一场比赛。我尝试了这个 Xpath: db/game[count(/@teams)<2] 但它给了我所有游戏.. 我的错误是什么?