Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xpath 如何在Google表中创建IF以匹配非布尔值?_Xpath_Google Sheets_Google Sheets Formula - Fatal编程技术网

Xpath 如何在Google表中创建IF以匹配非布尔值?

Xpath 如何在Google表中创建IF以匹配非布尔值?,xpath,google-sheets,google-sheets-formula,Xpath,Google Sheets,Google Sheets Formula,我有一个url,比如,我有不同的节点,比如 <1> <desc>one two</desc> <link>three four</link> </1> <2> <desc>five six</desc> <link>seven eight</link> </2> <3> <desc>ni

我有一个url,比如,我有不同的节点,比如

<1>
    <desc>one two</desc>
    <link>three four</link>
</1>

<2>
    <desc>five six</desc>
    <link>seven eight</link>
</2>

<3>
    <desc>nine ten</desc>
    <link>eleven twelwe</link>
</3>
但是你会得到这个错误

Function IF parameter 1 expects boolean values. But 'two' is a text and cannot be coerced to a boolean.
这个
=importxml(A1,“//*[包含(text(),'approvement')]|//链接”)
也以一个错误结束:

Array result was not expanded because it would overwrite data in C2.

今天运气不好…

我终于成功了:

=importxml(A1,"//*[contains(.,'two')]/desc")    =importxml(A1,"//*[contains(.,'two')]/link")

最后,这对我起了作用:

=importxml(A1,"//*[contains(.,'two')]/desc")    =importxml(A1,"//*[contains(.,'two')]/link")

如果您能够在google sheets中使用正则表达式,您可以尝试以下方法。我只在描述中搜索两个匹配项,如果存在匹配项,则捕获描述和链接文本<代码>(?如果您能够在google sheets中使用正则表达式,您可以尝试以下操作。我只在描述中搜索两个匹配项,如果存在匹配项,则捕获描述和链接文本。
(?)?