Template helper to validate IDs
Created by: yytosi
Template serialization contains the id_attr() helper, that currently makes sure no duplicates are assigned as XML IDs. The helper function should also validate the values that are used as IDs, so they conform to valid NCName type:
The type xsd:ID is used for an attribute that uniquely identifies
an element in an XML document. An xsd:ID value must be an NCName.
This means that it must start with a letter or underscore, and can
only contain letters, digits, underscores, hyphens, and periods.
xsd:ID carries several additional constraints:
- Their values must be unique within an XML instance, regardless of
the attribute's name or its element name.
- A complex type cannot include more than one attribute of type xsd:ID,
or any type derived from xsd:ID.
- xsd:ID attributes cannot have default or fixed values specified.