xml - Check if string is empty or not -
how can check if value empty or not xsl? example, if dadosis empty?
<hoteis id="1"> <codigo>458</codigo> <morada>porto</morada> <num_quartos>3</num_quartos> <piscina>não</piscina> <restaurante> <dados></dados> <num_mesas></num_mesas> <num_pessoas></num_pessoas> <hora_abertura></hora_abertura> <hora_fechar></hora_fechar> </restaurante> </hoteis>
for example:
<td align="center"> <xsl:value-of select= "ns:restaurante" > <xsl:for-each select="/hoteis/restaurante"> <xsl:if teste="dados != ''"> <tr bgcolor="#9acd32"> <td align="center">nº pessoas</td> <td align="center">nº mesas</td> <td align="center">hora abertura</td> <td align="center">hora fechar</td> </tr> <xsl:apply-templates select="//ns:restaurante"/> </xsl:if> </xsl:for-each> </xsl:value-of> </td>
how can this?
your method work if had used test
instead of teste
(unless have spanish portugese xslt processor...?).
personally, prefer:
<xsl:if test="dados/text()">
note test existence of text node, child of dados
- not same thing testing dados
being empty.
Comments
Post a Comment