Name

attribute — Pattern matching an attribute

Synopsis

“attribute” 
nameClass “{” 
pattern “}”

Restrictions

pattern

May be included in

(pattern), attribute, datatypeName param exceptPattern, element, list, mixed, pattern&pattern, pattern*, pattern+, pattern,pattern, pattern?, pattern|pattern

XML syntax equivalent

attribute

Description

The attribute pattern matches an attribute. The name of the attribute is defined using a nameClass, which may be either a single name or a name class. Note that, unlike the XML syntax, the content of an attribute doesn’t default to text and must always be explicitly defined.

Restrictions

  • After simplification, attribute patterns can contain only patterns relevant for text nodes.

  • Attributes can’t be duplicated, either directly or by overlapping name classes.

  • Attributes that have an infinite name class (anyName or nsName) must be enclosed in a oneOrMore pattern (or zeroOrMore before simplification).

Example

attribute available { text }
attribute xml:lang { xsd:language }
attribute * - (local:* | lib:* | hr:*) { text }

Get RELAX NG 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.