0
我試圖使用XQuery提取HTML表格的單元格中的所有值。我使用的查詢,你可以在下面找到,給出以下結果使用XQuery提取HTML表格的所有行和列(以及它們的rowspans和colspans)
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
爲什麼「孩子軸開始於一個屬性節點的節點將永遠不會選擇任何」我不明白。
我正在使用撒克遜。
下面是查詢
declare default element namespace "http://www.w3.org/1999/xhtml";
declare function local:analyzeTable(
$table as element(table))
{
for $r in $table//tr
return
for $c in $r//td
return (normalize-space($c), string("colspan"),
$c/@colspan//text() , string("rowspan"), $c/@rowspan//text())
};
for $t in //table
return
local:analyzeTable($t)
表
<table>
<tr>
<td colspan="2">hello</td>
</tr>
</table>