samedi 24 octobre 2015

how to use if logic in xslt

I have an xslt that takes and formats an xml, in my code I want to program the logic in case a link element is not present. In such a case i just want to write out the title no link. But I am not getting it to work, perhaps there is a better method. See snippet of code:

<td>
  <xsl:if test="link=">
    <!-- Look for link, target to blank, the link text is the tittle pulled from xml -->
    <a href="{link}" target="_blank">
      <xsl:value-of select="title" />
    </a>
  </xsl:if>

  <xsl:if test="link=">
    <xsl:value-of select="title" />
  </xsl:if>
</td>

Aucun commentaire:

Enregistrer un commentaire