Use:
//*[self::elementType or self::otherElementType]
/concat(., ' is a ', name(), '
')
When this expression is evaluated against the following XML document (the provided malformed fragment -- corrected):
<t>
<elementType>a</elementType>
<otherElementType>b</otherElementType>
<elementType>c</elementType>
<elementType>d</elementType>
</t>
The wanted, correct result is produced:
a is a elementType
b is a otherElementType
c is a elementType
d is a elementType
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…