xml – 使用xpath选择具有一组多个属性/值的元素
发布时间:2020-12-16 01:53:06 所属栏目:百科 来源:网络整理
导读:我有一个XML文档,我需要删除特定的数据 xml文档具有如下结构: – a b select='yes please' c d='text1' e='text11'/ c d='text2' e='text12'/ c d='text3' e='text13'/ c d='text4' e='text14'/ c d='text5' e='text15'/ /b /aa b select='no thanks' c d=
我有一个XML文档,我需要删除特定的数据
xml文档具有如下结构: – <a> <b select='yes please'> <c d='text1' e='text11'/> <c d='text2' e='text12'/> <c d='text3' e='text13'/> <c d='text4' e='text14'/> <c d='text5' e='text15'/> </b> </a> <a> <b select='no thanks'> <c d='text1' e='text21'/> <c d='text3' e='text23'/> <c d='text5' e='text25'/> </b> </a> <a> <b select='yes please'> <c d='text1' e='text31'/> <c d='text2' e='text32'/> <c d='text3' e='text33'/> <c d='text4' e='text34'/> <c d='text5' e='text35'/> </b> </a> <a> <b select='no thanks'> <c d='text4' e='text41'/> <c d='text3' e='text43'/> <c d='text5' e='text45'/> </b> </a> 我需要选择只有那些/ a / b元素组,d属性=’text1’和 希望明白 干杯 DD
您可以使用此XPath:
//a[b/c/@d = 'text1' and b/c/@d = 'text4']/b/c[@d = 'text5']/@e 它将选择第一和第三个a / b的e =’text15’和e =’text35′ XSLT: <xsl:template match="//a[b/c/@d = 'text1' and b/c/@d = 'text4']/b/c[@d = 'text5']"> <xsl:value-of select="@e"/> </xsl:template> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 【绝密外泄】风哥Oracle数据库DBA高级工程师培训视频教程与
- 当VB遇上C++
- XML 工具类分享
- flowtype – React.cloneElement Inexact类型与确切类型不兼
- 通过C#Web浏览器刮取网站以获取元素名称和ID
- react-native run-ios :CFBundleIdentifier, Does Not Exis
- [寒江孤叶丶的Cocos2d-x之旅_35]在Cocos2d-Lua中使用ProtoB
- ruby-on-rails – 使用bcrypt可移植生成Rails密码吗?
- Ruby – Mechanize:按类名和其他问题选择链接
- oracle 11g(11.2.0.4) install on rhel 6