#XSLT Instructions Reference

Every XSLT instruction is an XML element in the xsl: namespace that controls how the transformation proceeds. This reference covers all instructions supported by the PhoenixmlDb XSLT engine, organized by purpose.

#Instruction Categories

Category

Instructions

Description

Output

value-of, text, comment, processing-instruction, sequence, message

Producing text, nodes, and diagnostic output

Control Flow

if, choose/when/otherwise, switch, where-populated, on-empty, on-non-empty

Conditional processing

Variables and Parameters

variable, param, with-param

Declaring and passing values

Iteration and Sorting

for-each, sort, perform-sort, iterate, break, next-iteration

Looping and ordering

Grouping

for-each-group

Four grouping modes with current-group() and current-grouping-key()

Copying and Identity

copy, copy-of, mode on-no-match

Copying nodes and the identity transform pattern

Node Construction

element, attribute, namespace, document

Building nodes with dynamic names

Multiple Outputs

result-document, output

Generating multiple files and controlling serialization

Functions

function

Defining reusable functions callable from XPath

Keys and Cross-References

key

Indexing documents for fast lookup

String Analysis

analyze-string, matching-substring, non-matching-substring

Regex-based string processing

Error Handling

try, catch, assert, fallback

Handling errors and asserting conditions

Merging

merge, merge-source, merge-key, merge-action

Combining sorted input sources

Maps, Arrays, and Records

map, map-entry, array, array-member, for-each-member, record

Constructing structured data (XSLT 3.0/4.0)

Streaming and Accumulators

source-document, accumulator, accumulator-rule, fork

Processing large documents efficiently

Packages

use-package, accept, override, expose

Reusable stylesheet libraries with visibility control

Dynamic Evaluation

evaluate

Runtime XPath evaluation

Number Formatting

number, decimal-format, character-map

Numbering schemes and format customization

#Quick Reference

Every instruction follows this pattern:

<xsl:instruction-name attribute="value">
  <!-- content (other instructions or literal output) -->
</xsl:instruction-name>

Instructions can appear in two places:

  • Top-level declarations (children of xsl:stylesheet) — xsl:template, xsl:variable, xsl:function, xsl:key, xsl:output, etc.

  • Sequence constructors (inside templates and functions) — xsl:value-of, xsl:for-each, xsl:if, etc.

Some instructions (like xsl:variable and xsl:param) can appear in both positions with slightly different semantics.