Skip to main content

Module rewrite

Module rewrite 

Source
Expand description

Rules for rewriting the constructed XML document, after core processing has completed

Modules§

declare
The \lxDeclare pattern compiler and its paired structural matcher.

Structs§

MultiSelectEntry
A single sub-pattern in a MultiSelect clause. Perl: [$xpath, $nnodes, @wilds]
Rewrite
RewriteClause
RewriteOptions

Enums§

RewriteOperator
RewritePattern

Functions§

dom_to_xpath
Convert a DOM subtree to an XPath expression + wildcard position tracking. Perl: domToXPath() → domToXPath_rec() → domToXPath_seq()
mark_wildcards
Mark wildcard nodes in the matched tree. Perl: markWildcards($node, @wilds)
set_attributes_wild
Set attributes on a tree containing wildcards, creating XMDual wrappers. Perl: setAttributes_wild($document, $attributes, @nodes) — Rewrite.pm L195-217
set_wildcard_ids
Collect xml:ids of wildcard-marked nodes, generating IDs if needed. Collect xml:ids of wildcard-marked nodes, generating IDs if needed. Perl: set_wildcard_ids($document, $node) — Rewrite.pm L219-231 Faithfully translated: if node has _wildcard, return its ID. If node has _matched, skip (already processed by prior rule). Otherwise recurse into children.
unmark_wildcards
Unmark wildcard nodes after processing.

Type Aliases§

CompiledMatch
Result of domToXPath compilation: xpath string, node count, wildcard paths.
RewriteRegexpClosure
Regexp closure: Perl signature is ($string) → modified in-place via s///g.
RewriteReplaceClosure
RewriteTestClosure
Test closure: Perl signature is ($document, $node) → $nnodes (0/undef = skip).
WildPath
Wildcard position path: indices to navigate from matched root to wildcard node. First index uses nth_sibling (sibling offset), rest use nth_child (child position).