像这样的东西工作正常“concat('a', 'b')”,但我不能它作为现有表达式的一部分工作,即
<div class='xyz'>
<strong>the</strong>
<sub> one</sub>
</div>
//div[class='xyz']/concat(/strong/text(), /sub/text())
我希望它返回“那个”
最佳答案
i'd like it to return 'the one'
在XPath 1.0中,您必须执行以下操作:
concat(div[@class='xyz']/strong, div[@class='xyz']/sub)
在XSLT 1.0中,您可以:
<xsl:template match="/">
<xsl:for-each select="div[@class='xyz']/*">
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:template>
关于xslt - 如何在 XPath 表达式中的多个子项上使用 concat() 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32727009/