xml と xsl を学習し始めていますが、何らかの理由で xsl で xpath を機能させることができません。xml ドキュメントの構造が間違っているのでしょうか、それともゲーム 14 の価格がテーブルに表示されないのはなぜですか?
私のxslの試みは非常に簡単です:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My Games</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Game Name</th>
<th>Price</th>
</tr>
<tr>
<td><xsl:value-of select=
"Xboxspellen/Spellen/Spel[14]/Spelnaam"/></td>
<td><xsl:value-of select=
"Xboxspellen/Spellen/Spel[14]/Prijs"/></td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
xml コードの短いバージョン:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="Xboxspellen.xsl"?>
<Xboxspellen xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com
Xboxspellen.xsd">
<Genres>
...
<Genre id="Adv">
<Genrenaam>Adventure</Genrenaam>
<Spel idref="12"/>
<Spel idref="13"/>
<Spel idref="14"/>
</Genre>
</Genres>
<Spellen>
...
...
<Spel id="14">
<Spelnaam>Omerta: city of gangsters</Spelnaam>
<Uitgever>Kalypso</Uitgever>
<Prijs>49.98</Prijs>
<Leeftijd>16</Leeftijd>
<Aankoop>
<Dag>28</Dag>
<Maand>04</Maand>
<Jaar>2011</Jaar>
</Aankoop>
<Afbeelding>spel14.jpg</Afbeelding>
</Spel>
</Spellen>
</Xboxspellen>
私は何時間も物事を試してきましたが、答えが見つからないようです.誰かが私を助けることができれば、私はとても感謝しています:D