0

I have the following line I have used in the past to set a dashboard icon, how would I add another condition and if ttl_qsa_fin NE 0

<xsl:if test="normalize-space(@ttl_qsr_fin) = 0">
pinkstonmatt
  • 51
  • 1
  • 9
  • Possible duplicate of [Can you put two conditions in an xslt test attribute?](https://stackoverflow.com/questions/318875/can-you-put-two-conditions-in-an-xslt-test-attribute) – GSerg Mar 09 '18 at 19:23

1 Answers1

0

I suspect unlike the possible dupe answer linked to, you're also not sure how to add the not equals operator to the IF test.

The complete answer for your scenario is:

<xsl:if test="(normalize-space(@ttl_qsr_fin) = 0) and not(ttl_qsa_fin = 0)">

As Michael Kay explains here, while you could also write the second filter condition as !=, that approach would require ttl_qsa_fin always be present in your source XML to evaluate as true. By using not() though, it also account for cases in which ttl_qsa_fin is absent in the source XML.

And to be safe, confirm the data type of both ttl_qsr_fin and ttl_qsa_fin; if they are strings (which is implied by the use of normalize-space), then the IF test conditions should have the values being tested for wrapped in single quotes:

<xsl:if test="(normalize-space(@ttl_qsr_fin) = '0') and not(ttl_qsa_fin = '0')">
Stevangelista
  • 1,799
  • 1
  • 10
  • 15