Using xsl:key to store result of boolean expression
- by hielsnoppe
In my transformation there is an expression some elements are repeatedly tested against. To reduce redundancy I'd like to encapsulate this in an xsl:key like this (not working):
<xsl:key name="td-is-empty" match="td" use="not(./node()[normalize-space(.) or ./node()])" />
The expected behaviour is the key to yield a boolean value of true in case the expression is evaluated successfully and otherwise false. Then I'd like to use it as follows:
<xsl:template match="td[not(key('td-is-empty', .))]" />
Is this possible and in case yes, how?