简体   繁体   English

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

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

I am trying to do something like the pseudocode xpath //noah/(shem or cham or yefet) inside an xslt stylesheet and while I can do //noah/shem | //noah/cham | //noah/yefet我正在尝试在 xslt 样式表中执行类似伪代码 xpath //noah/(shem or cham or yefet)之类的事情,而我可以做//noah/shem | //noah/cham | //noah/yefet //noah/shem | //noah/cham | //noah/yefet //noah/shem | //noah/cham | //noah/yefet I also have the case of a 2*2 crossproduct case which gets ugly fast. //noah/shem | //noah/cham | //noah/yefet我也有一个 2*2 的叉积案例,它很快就会变得丑陋。

The actual stylesheet is here and I am trying to add a fact alias to f and a lang alias to l for this XML input that consists of factoids about people and things ( Chuck Norris/etc. ).实际的样式表在这里,我正在尝试为这个 XML 输入添加一个fact别名到f和一个lang别名到l ,该输入由关于人和事物的事实 (Chuck Norris/etc.) 组成。

In XPath 2 and later you can actually use //noah/(shem, cham, yefet) or //noah/(shem | cham | yefet) .在 XPath 2 及更高版本中,您实际上可以使用//noah/(shem, cham, yefet)//noah/(shem | cham | yefet) With XPath 1 you are restricted to //noah/*[self::shem or self::cham or self::yefet] .使用 XPath 1 你被限制为//noah/*[self::shem or self::cham or self::yefet]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM