本文介绍了xpath找到节点是否存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用xpath查询如何查找节点(标签)是否存在?
Using a xpath query how do you find if a node (tag) exists at all?
例如,如果我需要确保网站页面具有正确的基本结构如/ html / body和/ html / head / title
For example if I needed to make sure a website page has the correct basic structure like /html/body and /html/head/title
推荐答案
<xsl:if test="xpath-expression">...</xsl:if>
所以例如
<xsl:if test="/html/body">body node exists</xsl:if>
<xsl:if test="not(/html/body)">body node missing</xsl:if>
这篇关于xpath找到节点是否存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!