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">
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">
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')">