Given the following XML:
<Widget>
<thing>01234</thing>
<widerwidget>
<widgettype>10</widgettype>
</widerwidget>
</Widget>
I would like to restrict the length of based on the value in . will have fixed values, 10, 20 and 30 respectively. If it is 10 then the length of what is entered in can only be 13, if it is 20 then the length becomes 10 and lastly if it's 30 then length becomes 15 or less.
I'm trying to create an XSD that will allow this, but also restrict the input based on the value of . Is this possible ? And if so how ?
Restricting one element based on the value of another can't be done with XSD 1.0. It can be done in XSD 1.1 using assertions. XSD 1.1 is currently supported in Saxon, Xerces, and Altova.