Name

rng:ref — Refers to a named pattern

XML syntax example

<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<start>
 <ref name="torque"/>
</start>

<define name="torque">
 <element name="torque">
  <attribute name="value"/>
  <empty/>
 </element>
</define>

</grammar>

Compact syntax example

start = torque
torque = element torque { attribute value { text }, empty }

Parents

attribute, choice (( ) and |), define (name of pattern followed by =), element, except (-), group (( ) and ,), interleave (&), list, mixed, oneOrMore (+), optional (?), start (start followed by =), zeroOrMore (*)

Description

The ref pattern refers to a named pattern in a define element. In the compact syntax, a reference is made to a named pattern by using the name of the pattern by itself. References may be recursive (a ref within a named pattern may refer to itself) provided the reference is directly or indirectly within an element pattern that is contained in the definition.

See also

§4, define, externalRef, parentRef

Get XML Pocket Reference, 3rd Edition 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.