仅当存在“ / a / @ href”时,才如何通过IMPORTXML文本值“ / a”导入?

问题描述

当前公式:
IMPORTXML("https://int.soccerway.com/international/europe/uefa-champions-league/20192020/s17689/final-stages/","//td[@class='team team-a'] | //td[@class='team team-a strong']/a")

仅存在//td[@class='team team-a']//td[@class='team team-a strong']/a值的//td[@class='team team-a']/@href//td[@class='team team-a strong']/a/@href的导入值如何存在?

示例:

enter image description here

Winner Semi-final 2Winner Semi-final 1 不包含链接/ @ href

RB Leipzig 包含链接/ @ href -https://int.soccerway.com/teams/germany/rb-leipzig/13410/
PSG 包含链接/ @ href -https://int.soccerway.com/teams/france/paris-saint-germain-fc/886/

我想要的导入结果是这样:

RB莱比锡
PSG

解决方法

如果我对您的理解正确,这应该会有所帮助:

=IMPORTXML(url,"//h2[span='Semi-finals']/following-sibling::div[@class='content']//td[contains(@class,'team')]/a[@href]")

输出:

RB Leipzig
PSG

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...