我有一个 xml 文件,我需要使用 xsl:for-each-group 对其进行分组。一切正常,但问题来自于元素末尾有空格的情况(例如<word>test </word> and <word>test</word>
),但我需要将这些元素视为一组。
这是示例 xml 文件:
<u>
<s>
<w>this </w>
<w>is </w>
<w>a </w>
<w>test </w>
</s>
<s>
<w>this</w>
<w>is</w>
<w>a</w>
<w>test</w>
</s>
<u>
这是xslt代码
<xsl:for-each-group select="bncDoc/stext/div/u/s" group-by="w" >
<tr>
<td style="text-align: center;">
<xsl:value-of select="current-grouping-key()"/>
</td>
<td>
<xsl:value-of select="count(current-group())"/>
</td>
</tr>
</xsl:for-each-group>
有什么解决方法吗?