我正在使用XSLT處理器腳本從外部源獲取數據。 現在我想測試某個值是否爲空,然後返回空字段。 這是我現在在我的XSL樣式表中使用的代碼。使用XSL樣式表測試值是否爲空XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<table border="1" style="width:600px;margin-top:20px">
<tr>
<th align="left" style="text-transform: uppercase; font-size: 14px; color: white;font-weight: normal;">Date</th>
<th align="left" style="text-transform: uppercase; font-size: 14px; color: white;font-weight: normal;">Location</th>
<th align="right" style="text-transform: uppercase; font-size: 14px; color: white;font-weight: normal;">City</th>
<th align="right" style="text-transform: uppercase; font-size: 14px; color: white;font-weight: normal;">Country</th>
<th align="right" style="text-transform: uppercase; font-size: 14px; color: white;font-weight: normal;">Facebook</th>
</tr>
<xsl:for-each select="//item">
<tr>
<td style="text-align:left;"><xsl:value-of select="date" /></td>
<td style="text-align:left;color:#ccc;"><xsl:value-of select="location" /></td>
<td style="text-align:right;"><xsl:value-of select="city "/></td>
<td style="text-align:right;"><xsl:value-of select="country" /></td>
<td style="text-align:right;"><a>
<xsl:attribute name="href">
<xsl:value-of select="website" />
</xsl:attribute>
<xsl:attribute name="target">new</xsl:attribute>
I'm Attending
</a></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
我想有它返回一個鏈接到Facebook的事件鏈接的「網站」值的條件語句。但是,當沒有填充在系統中的數據從何而來,它不應該顯示(我參加)
這怎麼能與一個XSL測試或某種條件語句來預製的聯繫?