我需要获取一些元素的值,然后需要根据元素添加一些文本,例如:
<elementType>a</elementType>
<otherElementType>b</otherElementType>
<elementType>c</elementType>
<elementType>d</elementType>
$doc//*[self::elementType or self::otherElementType]/string()
"a"
"b"
"c"
"d"
这会返回值,但我不知道如何获取这样的值:
"a is an elementType"
"b is an otherElementType"
"c is an elementType"
"d is an elementType"