Xml 使用XQuery提取HTML表的所有行和列(及其行跨度和列跨度)

Xml 使用XQuery提取HTML表的所有行和列(及其行跨度和列跨度),xml,xquery,saxon,Xml,Xquery,Saxon,我试图用XQuery提取HTML表单元格中的所有值。我使用的查询(您可以在下面找到)给出了以下结果 Warning on line 11 column 22 of queryExtractTable.xq: The child axis starting at an attribute node node will never select anything Warning on line 11 column 63 of queryExtractTable.xq: The child a

我试图用XQuery提取HTML表单元格中的所有值。我使用的查询(您可以在下面找到)给出了以下结果

Warning on line 11 column 22 of queryExtractTable.xq:
  The child axis starting at an attribute node node will never select anything
Warning on line 11 column 63 of queryExtractTable.xq:
  The child axis starting at an attribute node node will never select anything
<?xml version="1.0" encoding="UTF-8"?>hello colspan rowspan
桌子

<table>
    <tr>
        <td colspan="2">hello</td>
    </tr>
</table>

你好

警告由以下表达式引发:

$c/@colspan//text()
@colspan
是属性节点,属性节点没有任何子节点。因此,当您请求属性的后代
text()
节点时,Saxon会发出警告

要访问这些属性的字符串值,可以将这些表达式更改为:

string($c/@colspan)
我看您已经熟悉了
string()
函数,例如
string(“colspan”)
;请注意这里的
string()
函数是无关的,并且
的“colspan”
足以构造一个文本字符串

有关
text()
string()
data()
的更多信息,请参阅

string($c/@colspan)