0
我有一個名爲channels的元素,它已經在XML文件中給出了值。我想要做的是當XML文件沒有任何通道時,向用戶顯示一條消息。 這是我的代碼。XSL如果元素的計數爲0,則顯示消息給用戶
<h2>Channels Subscription:</h2>
<xsl:template>
<xsl:if test=" <xsl:value-of select="count(subscription/channels)"/>
==0)">
<p>You have no channels</p>
</xsl:if>
</xsl:template>
上面的代碼不起作用 自帶另一部分至極後表..當用戶有一個通道或多個它就會顯示
<xsl:for-each select="subscription/channels">
<xsl:choose>
<xsl:when test="@favourite='true'">
<h3 >Channel Name:</h3> <h3 style="color:green;"><xsl:value-of select="@name"/></h3>
</xsl:when>
<xsl:otherwise>
<h3 >Channel Name: </h3><h3 style="color:black; "><xsl:value-of select="@name"/></h3>
</xsl:otherwise>
</xsl:choose>
<p>ID: <xsl:value-of select="@id"/></p>
<h3>Programs:</h3>
<xsl:for-each select="programs">
<table ID="gradient-style">
<tbody>
<tr>
<th>Program Name:</th>
<td><xsl:value-of select="name"/></td>
</tr>
<tr>
<th>Broadcast Time:</th>
<td>
<xsl:value-of select="@broadcastFrequency"/> at <xsl:value-of select="@broadcastTime"/>
</td>
</tr>
<tr>
<th>Description:</th>
<td><xsl:value-of select="description"/></td>
</tr>
</tbody>
</table>
</xsl:for-each>
和它的作品