开发者

XPath, XSL: How to select all nodes, not just elements, when xsl:param is a node-set?

开发者 https://www.devze.com 2022-12-12 07:37 出处:网络
In an XSL recursion, this <xsl:with-param name=\"items\" select=\"$items[position() > 1] would normally work to recurse with all nodes but the first. But it only works if the nodes are eleme

In an XSL recursion, this

<xsl:with-param name="items" select="$items[position() > 1]

would normally work to recurse with all nodes but the first. But it only works if the nodes are elements. If they are a mix of element and text nodes, the recursion fails, since, for example, $items[3] returns the third element node, not the third node, regardless whether 开发者_开发百科text or element.

So the expression sets the new $items to just the element nodes in the old $items. The text nodes are lost.

0

精彩评论

暂无评论...
验证码 换一张
取 消