Patterns

A pattern is a limited form of location path (described next). Patterns are used in XSLT when the need is to decide whether the current element appears in a given context. Patterns are only allowed to contain some expression constructs. As the need for patterns is limited to matching XSLT templates, the definition of patterns is actually provided in the XSLT standard, not the XPath standard.

Where patterns are allowed

Patterns are used in the Match attribute within the Key and Template elements, as well as the Count and From attributes within the Number element:

<template match="pattern">...</template>


<key match="pattern">...</key>


<number count="pattern" from="pattern">...</number>

Matching elements to patterns

Unlike other expressions, ...

Get XSL companion, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.