Skip to main content

Module patterns

Module patterns 

Source
Expand description

XSLT pattern matching (§33, §85 Phase 8).

XSLT patterns are a subset of XPath 1.0 used in match attributes of <xsl:template>, <xsl:key>, <xsl:strip-space>, <xsl:preserve-space>.

Patterns can include:

  • Location paths (relative and absolute)
  • Union patterns (pattern1 | pattern2)
  • Node tests: *, node(), text(), comment(), processing-instruction()
  • Attribute axis (@attr)
  • Namespace prefix tests (ns:*, ns:name)
  • Predicates (limited)
  • The id() and key() functions

§UPSTREAM-PARITY

Implements XSLT 1.0 §5 “Patterns” with match semantics matching libxslt 1.1.39. Pattern matching uses the XPath 1.0 AST from src/xml/xpath for parsing, then applies XSLT-specific matching rules.

§Courts

XSLT-PATTERNS-*

Structs§

_xsltPattern
Opaque pattern structure.
_xsltPatternStep
Opaque pattern step structure.

Constants§

XSLT_PAT_NO_PRIORITY
Sentinel for “no explicit priority” (upstream XSLT_PAT_NO_PRIORITY).

Functions§

get_pattern_matched_names
Get the names matched by a simple name-test pattern.
is_simple_name_pattern
Check if a pattern string matches a single step (simple name test).
is_union_pattern
Check if a pattern is a union pattern (contains |).
xsltCompilePattern
Compile an XSLT pattern string into a compiled pattern.
xsltDefaultPriority
Compute default priority for a match pattern.
xsltFreePattern
Free a compiled pattern.
xsltTestMatchPattern
Test whether a node matches a compiled pattern tree.
xsltTestPattern
Test whether a node matches a compiled pattern.