You have not explained what you mean by "does not matter." Here is a general solution :
not($v) and not(string($v))
This expression evaluates to true() if $v "does not matter."
Both conditions must be met because the string $v defined as '0' has a value, but not($v) is true() .
In XSLT 1.0, the default usage can be achieved differently if the βvalueβ is a collection of nodes or if the value is a scalar (for example, a string, number, or boolean).
@Alejandro provided one way to get the default value if the variable that should contain node -set is empty.
If the variable must contain a scalar, then the following expression returns its value (if it has a value) or (otherwise) the desired default value:
concat($v, substring($default, 1 div (not($v) and not(string($v)))))
Dimitre novatchev
source share