此XPath表达式//groups/groupInformation/@ groupID包含(.,'10300')执行从groupID获取"10300“的工作(见下文)。但是,如何从groupName、groupDescription等获取文本呢?想要检索"Carnell - Brown“等等。当我描述这个问题时,我不确定我是否正确地使用了"element“和"attribute”。
<groupInformation groupID="10300" groupName="Carnell - Brown" groupDescription="The comfortable contemporary design of the “Carnell-Walnut” upholstery collection features deeply stitched back cushioning and shaped chaise seating all surrounded with soft faux leather fabric which offers the beauty and character of leather to create the ultimate collection for any home." groupStyle="Contemporary" groupFeatures="Frame constructions have been tested with various equipment to simulate the home and transportation environments to insure durability. Corners are glued, blocked and stapled. All fabrics are pre-approved for wearability and durability against AHFA standards. Cushion cores are constructed of low melt fiber wrapped over high quality foam. Features metal drop-in unitized seat box for strength and durability. All metal construction to the floor for strength and durability. The reclining mechanism features infinite positions for comfort. Heavyweight faux leather upholstery fabric. Jumbo thread stitched detailing. Collection features the option of either power or non-power pieces." />发布于 2016-12-06 05:38:15
而不是回答here,
//groups/groupInformation/@groupID[contains(., '10300')]/parent::*/@groupName我建议,
//groups/groupInformation[@groupID='10300']/@groupName因为
当@groupID为10300999或9991030时,
发布于 2016-12-06 05:28:02
这样做://groups/groupInformation/@groups包含(.,'10300')/parent::*/@groupName
https://stackoverflow.com/questions/40982760
复制相似问题