I want to be able to specify a attribute in xml can be a specific value or an xml substitution
e.g.
<my_element value1="barney" value2="${otherPerson}" />
I tried
<xs:simpleType name="MyTypeWithPlaceholder">
<xs:union memberTypes="MyType PlaceholderType"/>
</xs:simpleType>
<xs:simpleType name="MyType ">
<xs:restriction base="xs:string">
<xs:enumeration value="barney"/>
<xs:enumeration value="fred"/>
<xs:enumeration value="wilma"/>
<xs:enumeration value="betty"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="PlaceholderType">
<xs:restriction base="xs:string">
<xs:pattern value="\$\{[a-z][A-Z]\}"/>
</xs:restriction>
</xs:simpleType>
That did not seem to work.
Or is this out of scope with XML and the tools I am using should just recognize the ${xyz} is a variable?
You need a quantifier on the letter ranges, to indicate that they can occur more than just once.
And when you have the lower-case range followed by the upper-case range, then the regex is saying there will be one lower-case letter and then one upper-case letter.
I would combine them and use +
to indicate that there must be at least one letter, but could be many:
\$\{[a-zA-Z]+\}