I have a situation where my XML is going to contain a length that could be in kilobytes, or megabytes. The XML would look like either of the following:
<size>100M</size>
<size>100K</size>
I need to ensure that if entered data ends with a K, the number is less than 2096129 (and greater than 0), but if the data ends with an M, the number needs to be less than 2048 (and greater than 0). Is it possible to treat everything but the last character as an integer (so I can use the min/max inclusive tags), but still use a pattern on the last character?
No, you cannot use any xs:decimal or any of its subtypes here, and hence you have to use xs:string and cannot use min/max excusive, because there is no language feature in XML Schema to compose a simple type as a concatenation of other simple types.
The only way to do this with XSD 1.0 is to create a pattern (regex) that covers the whole pair of the numeric value and its unit. Depending on your min/max values, that could look a bit nasty, but it should be straightforward.
(With XSD 1.1 you could use assertions)