本文介绍了我怎么知道xslt中根节点和当前节点之间的特定节点总数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hi All, I want to count the total number of specific nodes between root node and current node. for Example: <pre lang="text"><w:body xmlns:w="#unknown"> <!-- root Node --> <w:p /> <w:rect> <w:p>some text1</w:p> </w:rect> <w:p /> <w:rect> <w:p>some text2</w:p> </w:rect> <w:p /> <w:p /> <w:p /> <w:rect> <w:p>some text5</w:p> <!-- This is current node now --> </w:rect> <w:p /> <w:p /> <w:p /> <w:p /> </w:body>
这是我的情况.在这里,假设一些文本是我的当前节点.所以,现在我想获取当前节点的parent :: w:p(假设此节点名称为"targetNode").之后,我想计算从根节点到targetNode的w:p级别相同的总数. 我想要的输出是:5 请引导我解决此问题...
This is my scenario.Here, Assume some text is my current node.So, Now i want to get the parent::w:p of the current node (Assume this node name as "targetNode"). After that i want to calculate total number of the same level of w:p from root node to targetNode. My wanted output is :5 Please Guide me to get out of this issue...
推荐答案count(祖先:: w:p [1]/preceding-sibling :: w:p + 1)(第一个祖先w:p本身). count(ancestor::w:p[1]/preceding-sibling::w:p + 1)(the first ancestor w:p itself).
更多推荐
我怎么知道xslt中根节点和当前节点之间的特定节点总数?
发布评论