xs:NMTOKEN

Construct an NMTOKEN value from an item value.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

xs:NMTOKEN(item $value) => NMTOKEN

Description

This is a constructor function that takes an item value as argument and returns a value of type xs:NMTOKEN. If the argument is a literal, then the literal must be a valid lexical form of its type.

As specified in the respective section of the W3C recommendation XML Schema Part 2: Datatypes, a value of type xs:NCName denotes an XML name token, as defined in the XML 1.0 recommendation. It is derived from the type xs:token and the lexical form of xs:NMTOKEN is the set of all strings that match the production of Nmtoken. Practically, a value of type xs:NMTOKEN is the same as of type xs:Name with the only exception that it may not contain a colon.

Argument

$value

item value

Examples

  • The following queries generate valid values of type xs:NMTOKEN

    xs:NMTOKEN("-header")
    xs:NMTOKEN(":R2D2")
  • The following queries generate invalid values:

    xs:NMTOKEN("+header")

    The plus sign is not allowed in a name token.

    xs:NMTOKEN("R2D2 C3PO")

    It is interpreted as two tokens and thus cannot be a value of a single name token.