It often happens that an element or an attribute in an XML document contains a GUID value. Because XML documents are useless without the corresponding XSD, it also often happens, that you have to define a GUID in XSD. Although XSD has support for several built-in types, unfortunately GUID is not one of them, and you have to use the classic regex solution:
After this you can refer to your new guid type just like the built-in ones:
<xs:attribute name="id" type="guid" use="required" />
Note that the regex pattern does not have $ and ^ characters in the beginning and in the end, because the pattern should always match the full value.