Hi Markus,

You need to use xsd:string instead of xsd:token.
For details please see

For all ·atomic· datatypes other than string (and types ·derived· by 
·restriction· from it) the value of whiteSpace is collapse and cannot be 
changed by a schema author;

The value collapse means:
     After the processing implied by replace, contiguous sequences of 
#x20's are collapsed to a single #x20, and leading and trailing #x20's 
are removed.

Best Regards,
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger

On 5/5/10 8:56 AM, Marcus Bingenheimer wrote:
> Dear all,
> I have a question regarding the restriction of whitespace in attribute
> values.
> I restrict the pattern that can appear in the KEY attribute to
> /"a A or a G followed by six digits, or otherwise the value 'unknown/'"
> like that in the ODD:
> <attDef ident="key" mode="change">
> <desc>Key for the authority database.</desc>
> <datatype>
> <rng:data type="token">
> <rng:param name="pattern">(A\d{6})|(G\d{6})|unknown</rng:param>
> </rng:data>
> </datatype>
> </attDef>
> (i know the regex could be shorter, but we keep it like that for legibility)
> Now the schema produced from this duly records this as:
> attribute key {
>        xsd:token { pattern = "(A\d{6})|(G\d{6})|unknown" }
>      }?, validates
> and validates eg.:
> <persName key="A003597">XXXX</persName>
> It does however also validate KEY values with whitespace before or after
> the token such as:
> <persName key=" A003597">XXXX</persName>
> or
> <persName key="A003597 ">XXXX</persName>
> I wish the schema could catch that, but do not understand why it doesn't.
> Any ideas?
> thanks for thinking about this
> marcus
> --
> ============================
> Dr. Marcus Bingenheimer 馬德偉
> Dharma Drum Buddhist College  法鼓佛教研修學院 (DDBC)
> No. 2-6 Xishihu, Jinshan  20842, Taipei County, Taiwan, R.O.C.
> 台灣,20842台北縣金山鄉西勢湖2-6號  Tel:  +886-2-2498-0707#2227