将 xpath xml 元素的联合表示为 XSLT/XPath 中共同父项的子项

Expressing an xpath xml elements' union as a child of a common parent in XSLT/XPath

我正在尝试在 xslt 样式表中做类似伪代码 xpath //noah/(shem or cham or yefet) 的事情,虽然我可以做 //noah/shem | //noah/cham | //noah/yefet 我也有一个 2*2 交叉积的情况,它很快变得丑陋.

实际的样式表是 here and I am trying to add a fact alias to f and a lang alias to l for this XML input,其中包含关于人和事的事实(查克 Norris/etc。 )。

在 XPath 2 及更高版本中,您实际上可以使用 //noah/(shem, cham, yefet)//noah/(shem | cham | yefet)。使用 XPath 1,您只能使用 //noah/*[self::shem or self::cham or self::yefet].