Change the source, watch the table

Edit any source and Tab out: cem-data imports a typed CEM AST. The CEMT viewer discovers repeated XML siblings or array members and builds the table and its columns. Select a row with โ—‹, then compare Aโ€“Z with 1โ€“9 sorting: โ€œ10โ€ precedes โ€œ2โ€ as text, but follows it as a number. โ†‘ / โ†“ changes direction; equal keys keep source order.

โˆ… means missing; "" is an empty string. Missing or nonnumeric keys sort last. Selection follows source identity through sorting; changing the source clears its highlight. โ†บ restores the authored source and its matching selection. Expand/collapse each table with its keyboard-operable summary.

XML attributes use @name, direct text uses #text, and namespaces remain distinct. Namespace declarations such as xmlns:p are not data columns or tree attribute details. JSON/YAML sequences become rows; nested collections get their own tables at labeled collection names. CSV uses a comma delimiter and its first row as headings; quoted commas, quotes and newlines are supported.

This is an explicit table view, not a lossless tree/export editor. XML comments and processing instructions remain inert text and never execute. DTDs/unresolved entities and YAML anchors, aliases, explicit tags or complex keys are rejected. Sources are limited to 32 KiB, 64 levels and 4096 events/values; generic query and template budgets also bound rendering. Keep this interactive teaching sample small. Parse errors replace the tables rather than leave stale results.

Rust supplies format readers and reusable seq:group_by / seq:sorted functions, not table-view code. Row discovery, cells, headings and presentation are authored in CEMT or XSLT 3.0. Both use the same CEM-ML import and CEM node model.

๐Ÿงฉ Extend presentation with matching aspects

Like <xsl:template match="โ€ฆ">, a CEMT template @match rule selects a presentation for the current native node. apply-templates @mode=inspect dispatches it. Higher priority wins, then local over imported rules, then later declarations. Unmatched values emit nothing.

The fifth case imports the unchanged base viewer and adds two small presentation aspects: notes become a tree and an IP-filter record becomes a form. Toggle ๐Ÿงฉ to restore the defaults; other collections keep their tables. The form edits a local preview, not the original source or a firewall.

Compare the XSLT 3.0 viewer

Cases six and seven use the XSLT viewer and its imported aspects. They provide the same editing, stable sorting, selection and local form preview. Each declaration maps scalar UI state to named template parameters; XML, JSON, YAML and CSV source is imported into native CEM trees before XPath reads it. XSLT runs through the CEM runtime.

See also

Override individual cells with template matching

Table inspector: multiple selection and per-table sorting

Retained document trees and branch selection

XPath stable sorting

XPath maps and arrays ยท XPath numeric aggregates

XPath sequences and columns ยท XPath XML tables and trees ยท Data-island trees and external templates ยท Authored table rows ยท Focus-preserving edits