私は自分のHWxml/xslで作業しています。私は本当に新しいです-この分野の蜂。これが私のコードです:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:pre="/home/sbtge/Documents/1.SCHOOL/Webove_technologie/vypracovanie"
exclude-result-prefixes="pre">
<xsl:output method="html"/>
<xsl:template match="pre:document">
<html>
<link rel="stylesheet" href="nutri.css" type="text/css"/>
<head>
<title> Nutričné hodnoty </title>
</head>
<body>
<h1> Nutričné hodnoty </h1>
<div>
<table>
<tr>
<th>Name</th>
<th>Kategória <br/> (g) </th>
<th>Cukry <br/> (g) </th>
<th>Tuky <br/> (g) </th>
<th>Bielkoviny <br/> (g) </th>
<th>Energia <br/> (kJ) </th>
</tr>
<xsl:apply-templates select="pre:food"/>
</table>
</div>
</body>
</html>
</xsl:template>
<xsl:template match="pre:food">
<tr>
<td><xsl:value-of select="pre:name"/></td>
<xsl:choose>
<xsl:when test="pre:category='Zelenina'">
<div class="Zelenina">
<td><xsl:value-of select="pre:category"/></td>
</div>
</xsl:when>
<xsl:when test="pre:category='Ovocie'">
<div class="Ovocie">
<td><xsl:value-of select="pre:category"/></td>
</div>
</xsl:when>
<xsl:when test="pre:category='Ryža'">
<div class="Ryza">
<td><xsl:value-of select="pre:category"/></td>
</div>
</xsl:when>
<xsl:when test="pre:category='Mäso'">
<div class="Maso">
<td><xsl:value-of select="pre:category"/></td>
</div>
</xsl:when>
</xsl:choose>
<xsl:apply-templates select="pre:values"/>
</tr>
</xsl:template>
<xsl:template match="pre:values">
<td><xsl:value-of select="pre:sacharides"/> g</td>
<td><xsl:value-of select="pre:fat"/> g</td>
<td><xsl:value-of select="pre:proteins"/> g</td>
<td><xsl:value-of select="pre:energy"/> g</td>
</xsl:template>
すべてが正常に機能しますが、xsl:chooseは無視されます。「テスト」宣言が悪いからだと思います。どうすれば修正できますか?どうもありがとう。@ pre:category、pre:@ category、@categoryのようなものをすべて試しました。