如何使用Xpath(using XSLT)查询遍历回XML文件中的父节点? [英] How to traverse back to the parent node in the XML file by using Xpath(using XSLT) query?

查看:29
本文介绍了如何使用Xpath(using XSLT)查询遍历回XML文件中的父节点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们有一个深度为 N 的 xml 树.我已经遍历了最后一个节点,这意味着我到达了最后一个音符.现在我想从最后一个节点回到 xml 树中的某个级别(比如 N-3).

Let us have a xml tree of depth N. I have traveresd the last node means i am at last note. Now i wanted to go back to some level up (say at N-3) in the xml tree from that last node.

请让我知道 XPATH 查询的语法,以便我可以到达 xml 树中的预期节点.

Please let me know the syntax for the XPATH query so that i can reached at intended node in the xml tree.

推荐答案

使用:

ancestor::node()[3]

../../..

这篇关于如何使用Xpath(using XSLT)查询遍历回XML文件中的父节点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆