J'essaie d'extraire toutes les valeurs dans les cellules d'un tableau HTML avec XQuery. La requête que je utilise, que vous trouverez ci-dessous donne le résultat suivantExtraction de toutes les lignes et colonnes (avec leurs lignes et colspans) d'un tableau HTML avec XQuery
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
Je ne comprends pas pourquoi « L'axe de l'enfant à partir d'un noeud de noeud d'attribut ne sera jamais rien sélectionner ».
J'utilise Saxon.
Voici la requête
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)
Le tableau
<table>
<tr>
<td colspan="2">hello</td>
</tr>
</table>