I think with XSLT 1.0 a key value is always of type string so in your sample the key value with either be the string true
or the string false
. You could then call key('td-is-empty', 'true')
to find all td
element nodes for which the expression is true and key('td-is-empty', 'false')
to find all td
elements for which the expression is false.
You seem to want to do something differently with your key however, like storing the result of the use
expression for each td
node, based on node identity. I don't think that is how keys work in XSLT.
[edit] You might however be able to express your requirement as
<xsl:template match="td[count(. | key('td-is-empty', 'false')) = count(key('td-is-empty', 'false'))]">...</xsl:template>
That matches those td
elements which are a member of the set of elements found by key('td-is-empty', 'false')
.