by Eric van der Vlist is published by O'Reilly & Associates (ISBN: 0596004214)


Name

attribute — Pattern matching an attribute

Synopsis

element attribute
{
 (
 attribute ns { text }?,
 attribute datatypeLibrary { xsd:anyURI }?,
 attribute * - (rng:* | local:*) { text }*
 ),
 (
 attribute name { xsd:QName }
 | (
 ( element * - rng:* { ... }* )
 & (
 element name { ... }
 | element anyName { ... }
 | element nsName { ... }
 | element choice { ... }
 )
 )
 ),
 (
 ( element * - rng:* { ... }* )
 & (
 element element { ... }
 | element attribute { ... }
 | element group { ... }
 | element interleave { ... }
 | element choice { ... }
 | element optional { ... }
 | element zeroOrMore { ... }
 | element oneOrMore { ... }
 | element list { ... }
 | element mixed { ... }
 | element ref { ... }
 | element parentRef { ... }
 | element empty { ... }
 | element text { ... }
 | element value { ... }
 | element data { ... }
 | element notAllowed { ... }
 | element externalRef { ... }
 | element grammar { ... }
 )?
 )
}

Class

pattern

May be included in

attribute, choice, define, element, except, group, interleave, list, mixed, oneOrMore, optional, start, zeroOrMore

Compact syntax equivalent

attribute

Description

The attribute pattern matches an attribute. The name of the attribute may be defined by using either a name attribute or a name class.

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 or zeroOrMore pattern.

Example

<attribute name="id"/>

<attribute name="xml:lang">
  <data type="language"/>
 </attribute>
<attribute>
  <anyName/>
</attribute>

Attributes

datatypeLibrary

This attribute defines the default datatype library. The value is inherited.

name

When name is specified, the attribute pattern matches attributes with this name only. This can be a shortcut to define a single name as a name class for the attribute pattern).

name and the definition of a name class can't both be specified (they are exclusive options).

ns

This attribute defines the namespace of the attribute. Note that in the context of the attribute pattern, the ns attribute isn't inherited.


This text is released under the Free Software Foundation GFDL.