Is it possible to do inline conditionals (if then else) in XSLT? Something like:
<div id="{if blah then blah else that}"></div>
Or a real use-case/example:
<div id="{if (@ID != '') then '@ID' else 'default'}"></div>
Or a real use-case/exa" /> Or a real use-case/exa" /> Or a real use-case/exa"/>
Is it possible to do inline conditionals (if then else) in XSLT? Something like:
<div id="{if blah then blah else that}"></div>
Or a real use-case/example:
<div id="{if (@ID != '') then '@ID' else 'default'}"></div>
Copyright © 2021 Jogjafile Inc.
As mentioned in the comments, the
if () then elseconstruct is only supported in XSLT/XPpath 2.0.My own preference would be to use the verbose, but readable:
or perhaps a shorter:
However, if you're into cryptic code, you may like:
or: