genfunctions

command
v2.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL