How can I compare strings to create a table with XSLT?
I have an xml like this:
<Os>
<O type="xyz">
<Count>126</Count>
<Food>Yes</Food>
<Owner name="Jack">
<Phone>564815</Phone>
</Owner>
<Date>12/12/2014</Date>
</O>
<O type="zyx">
<Count>56</Count>
<Food>No</Food>
<Owner name="Phill">
<Phone>826633</Phone>
</Owner>
<Date>09/11/2015</Date>
</O>
</Os
And I want to traverse in it with for each and add a row if food='yes'.
<xsl:for-each select="Organizasyonlar/Organizasyon">
<xsl:sort select="KişiSayısı" data-type="number" />
<tr>
<td><xsl:value-of select="@type"/></td>
<td><xsl:value-of select="Count"/></td>
<td><xsl:value-of select="Food"/></td>
<td><xsl:value-of select="Owner/@name"/></td>
<td><xsl:value-of select="Owner/Phone"/></td>
<td><xsl:value-of select="Date"/></td>
</tr>
</xsl:for-each>
I think I can do it if I say food:1 when there is food and food:0 when there is not. And then I can write an if statement food>0 but I don't want to do that.
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire