仅当“/a/@href”存在时,如何通过“/a”的 IMPORTXML 文本值导入?
How import via IMPORTXML text value of "/a" only if "/a/@href" exists?
当前公式:
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
值?
示例:
Winner Semi-final 2
和 Winner Semi-final 1
不包含 links /@href
RB Leipzig
包含 link /@href - https://int.soccerway.com/teams/germany/rb-leipzig/13410/
PSG
包含 link /@href - https://int.soccerway.com/teams/france/paris-saint-germain-fc/886/
我想要的导入结果是这样的:
RB Leipzig
PSG
如果我理解正确,这应该对您有所帮助:
=IMPORTXML(url,"//h2[span='Semi-finals']/following-sibling::div[@class='content']//td[contains(@class,'team')]/a[@href]")
输出:
RB Leipzig
PSG
当前公式:
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
值?
示例:
Winner Semi-final 2
和 Winner Semi-final 1
不包含 links /@href
RB Leipzig
包含 link /@href - https://int.soccerway.com/teams/germany/rb-leipzig/13410/
PSG
包含 link /@href - https://int.soccerway.com/teams/france/paris-saint-germain-fc/886/
我想要的导入结果是这样的:
RB Leipzig
PSG
如果我理解正确,这应该对您有所帮助:
=IMPORTXML(url,"//h2[span='Semi-finals']/following-sibling::div[@class='content']//td[contains(@class,'team')]/a[@href]")
输出:
RB Leipzig
PSG