basex-lsp/test/ast.xq
2025-10-30 12:51:14 +00:00

20 lines
547 B
Text

import module namespace ast="lsp/ast" at "../webapp/lsp/ast/ast.xqm";
(: declare variable $file:="sample.docs/pdfbox.xqm"; :)
declare variable $file:="sample.docs/simple.xq";
declare variable $A:=doc("sample.docs/parse-pdfbox.xml");
unparsed-text($file)
=>ast:build()
update{
for $e in descendant-or-self::element()
let $len:=string-length($e)
let $before:=$e/preceding-sibling::node()/string-length()=>sum()
return (insert node attribute len { $len } into $e,
insert node attribute before { $before } into $e
)
}