[英]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
//noah/shem | //noah/cham | //noah/yefet
//noah/shem | //noah/cham | //noah/yefet
我也有一個 2*2 的叉積案例,它很快就會變得丑陋。
實際的樣式表在這里,我正在嘗試為這個 XML 輸入添加一個fact
別名到f
和一個lang
別名到l
,該輸入由關於人和事物的事實 (Chuck Norris/etc.) 組成。
在 XPath 2 及更高版本中,您實際上可以使用//noah/(shem, cham, yefet)
或//noah/(shem | cham | yefet)
。 使用 XPath 1 你被限制為//noah/*[self::shem or self::cham or self::yefet]
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.