Best Approach for Writing XPath for Conditional Discount Display

Hi,

What would be the best approach to writing an XPath expression to achieve the following logic?

  • If the discount amount is greater than zero, display the value as is (e.g., if the discount amount is +$25, display 25).
  • If the discount amount is less than zero, display the absolute value within parentheses (e.g., if the discount amount is - $25, display (25)).
  • If the discount amount is zero, display a blank value.

I’d appreciate any guidance or best practices on achieving this.

Thanks!