大家好我有这个xml文件描述了我想在浏览器中显示为HTML的篮球队,但是当我在浏览器中加载XML时它是空的我一定错过了什么。
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="BasketballTeamHTML1.xsl"?>
<!DOCTYPE BasketballTeam SYSTEM "BasketballTeam.dtd">
<BasketballTeam id="Chicago Bulls">
<Players>
<Point_guards>
<Point_guard position="1">
<point_guard_first_name>Aaron</forward_first_name>
<point_guard_last_name>Brooks</forward_last_name>
<point_guard_club_team>Chicago Bulls</forward_club_team>
</Point_guard>
</Point_guards>
<Shooting_guards>
<Shooting_guard position="2">
<shooting_guard_first_name>Jimmy</forward_first_name>
<shooting_guard_last_name>Butler</forward_last_name>
<shooting_guard_club_team>Chicago Bulls</forward_club_team>
</Shooting_guard>
</Shooting_guards>
<Small_forwards>
<Small_forward position="3">
<small_forward_first_name>Mike</forward_first_name>
<small_forward_last_name>Dunleavy</forward_last_name>
<small_forward_club_team>Chicago Bulls</forward_club_team>
</Small_forward>
</Small_forwards>
<Power_forwards>
<Power_forward position="4">
<power_forward_first_name>Cameron</forward_first_name>
<power_forward_last_name>Bairstow</forward_last_name>
<power_forward_club_team>Chicago Bulls</forward_club_team>
</Power_forward>
</Power_forwards>
<Centers>
<Center position="5">
<center_first_name>Nazr</forward_first_name>
<center_last_name>Mohammed</forward_last_name>
<center_club_team>Chicago Bulls</forward_club_team>
</Center>
</Centers>
</Players>
<Coaches>
<Coach degree="Head">
<coach_first_name>Tom</coach_first_name>
<coach_last_name>Thibodeau</coach_last_name>
<coach_salary>$4,375,000</coach_salary>
</Coach>
<Coach degree="Assistant">
<coach_first_name>Andy</coach_first_name>
<coach_last_name>Greer</coach_last_name>
<coach_salary>Unknown</coach_salary>
</Coach>
</Coaches>
<Games>
<Game league="NBA">
<score>92:90</score>
<home_team>Indiana Pacers</home_team>
<away_team>Chicago Bulls</away_team>
<stadium>Bankers Life Fieldhouse</stadium>
<city>Indianapolis</city>
</Game>
<Game league="NBA">
<score>80:96</score>
<home_team>Chicago Bulls</home_team>
<away_team>Brooklyn NETS</away_team>
<stadium>United Center</stadium>
<city>Chicago</city>
</Game>
<Game league="NBA">
<score>89:94</score>
<home_team>Denver Nuggets</home_team>
<away_team>Chicago Bulls</away_team>
<stadium>Denver Arena</stadium>
<city>Denver</city>
</Game>
<Game league="NBA">
<score>95:104</score>
<home_team>Нова Зеландия</home_team>
<away_team>Chicago Bulls</away_team>
<stadium>Oklahoma arena</stadium>
<city>Oklahoma city</city>
</Game>
</Games>
</BasketballTeam>
这是xls文件和爸爸,但它没有在浏览器中显示
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT BasketBallTeam (Players, Coaches, Games)>
<!ELEMENT Players (Point_guards, Shooting_guards, Small_forwards, Power_forwards, Centers)>
<!ELEMENT Point_guards (Point_guard+)>
<!ELEMENT Point_guard (point_guard_first_name, point_guard_last_name, point_guard_club_team)>
<!ELEMENT point_guard_first_name (#PCDATA)>
<!ELEMENT point_guard_last_name (#PCDATA)>
<!ELEMENT point_guard_club_team (#PCDATA)>
<!ELEMENT Shooting_guards (Shooting_guard+)>
<!ELEMENT Shooting_guard (shooting_guard_first_name, shooting_guard_last_name, shooting_guard_club_team)>
<!ELEMENT shooting_guard_first_name (#PCDATA)>
<!ELEMENT shooting_guard_last_name (#PCDATA)>
<!ELEMENT shooting_guard_club_team (#PCDATA)>
<!ELEMENT Small_forwards (Small_forward+)>
<!ELEMENT Small_forward (small_forward_first_name, small_forward_last_name, small_forward_club_team)>
<!ELEMENT small_forward_first_name (#PCDATA)>
<!ELEMENT small_forward_last_name (#PCDATA)>
<!ELEMENT small_forward_club_team (#PCDATA)>
<!ELEMENT Power_forwards (Power_forward+)>
<!ELEMENT Power_forward (power_forward_first_name, power_forward_last_name, power_forward_club_team)>
<!ELEMENT power_forward_first_name (#PCDATA)>
<!ELEMENT power_forward_last_name (#PCDATA)>
<!ELEMENT power_forward_club_team (#PCDATA)>
<!ELEMENT Centers (Power_forward+)>
<!ELEMENT Center (center_first_name, center_last_name, center_club_team)>
<!ELEMENT center_first_name (#PCDATA)>
<!ELEMENT center_last_name (#PCDATA)>
<!ELEMENT center_club_team (#PCDATA)>
<!ELEMENT Coaches (Coach+)>
<!ELEMENT Coach (coach_first_name, coach_last_name, coach_salary)>
<!ELEMENT coach_first_name (#PCDATA)>
<!ELEMENT coach_last_name (#PCDATA)>
<!ELEMENT coach_salary (#PCDATA)>
<!ELEMENT Games (Game+)>
<!ELEMENT Game (score, home_team, away_team, stadium, city)>
<!ELEMENT score (#PCDATA)>
<!ELEMENT home_team (#PCDATA)>
<!ELEMENT away_team (#PCDATA)>
<!ELEMENT stadium (#PCDATA)>
<!ELEMENT city (#PCDATA)>
<!ATTLIST BasketballTeam id ID #REQUIRED>
<!ATTLIST Team position (1|2|3|4|5) #REQUIRED>
<!ATTLIST Coach degree CDATA #REQUIRED>
<!ATTLIST Game league CDATA #REQUIRED>
<!ATTLIST Game final_score CDATA #IMPLIED>
这是xsl文件:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sq="http://www.w3.org/2005/sparql-results#">
<xsl:output method="html" encoding='UTF-8' indent='yes' doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system="http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd"/>
<xsl:template match="/BasketballTeam">
<html>
<head>
<title>Basketball Team</title>
</head>
<body>
<h1><xsl:value-of select="@id"/></h1>
<div class="team-logo">
<img src="../XML/images/chi.png" alt="Chicago Bulls" />
</div>
<xsl:apply-templates select="Players" />
</body>
</html>
</xsl:template>
<xsl:template match="Players">
<div class="player">
<h2>Point guards</h2>
<table>
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Basketball Team</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="Point_guards/Point_guard">
<xsl:sort data-type="text" order="ascending" select="point_guard_last_name"/>
<tr>
<td><xsl:value-of select="point_guard_first_name" /></td>
<td><xsl:value-of select="point_guard_last_name" /></td>
<td><xsl:value-of select="point_guard_club_team" /></td>
</tr>
</xsl:if>
</xsl:for-each>
</tbody>
</table>
</div>
</xsl:template>
</xsl:stylesheet>
有什么建议吗?它看起来不错,但我可能会遗漏一些东西:(