Documentation
¶
Overview ¶
Command genfunctions extracts the F&O 3.1 function proformas into the normalized manifest xpath/spec/function-signatures.json.
The audit's finding 6 is that xpath.Function carries a name, an arity and a callback but no declared parameter types, which is why twelve functions each needed a hand fix to stop accepting an empty sequence for a parameter F&O declares without "?" (commit 7668773) and why nothing prevented a thirteenth. A manifest derived from the specification rather than typed by hand is what makes that class of defect structural rather than incidental.
The source is the vendored Recommendation, not the network:
testdata/xslt30-test/specs/functions-and-operators-31.html
"XPath and XQuery Functions and Operators 3.1", W3C Recommendation 21 March 2017 — the same document published at https://www.w3.org/TR/xpath-functions-31/. Generation is therefore offline and deterministic, as the plan requires: a production build never fetches a W3C page, and the committed JSON is the reviewable artifact.
Usage:
go run ./cmd/genfunctions -spec <html> -out xpath/spec/function-signatures.json
The extraction reads the <div class="proto"> blocks, which is where the specification puts every signature. Two layouts appear: a one-line form for short signatures and a <table class="proto"> whose rows are one parameter each. Stripping tags flattens both to the same text, so one parser covers them.