# derivation by restriction
[% IF (base = simpleType.get_base) -%]
use base qw(
    [%
    base_type = definitions.get_types.0.find_type(simpleType.expand(base));
    IF ! base_type;
        THROW NOT_FOUND "base type $base not found." _ simpleType.get_parent.get_name;
    END;
    XSD.create_xsd_name(base_type) %]);
[% ELSIF (type = simpleType.first_simpleType() );
    INCLUDE simpleType/atomicType.tt(type = type);
ELSE;
    THROW "neither base nor atomic type - don't know what to do" %]
[% END %]