W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2002

Re: <length> = a real number plus a unit qualification

From: Jeni Tennison <jeni@jenitennison.com>
Date: Mon, 13 May 2002 21:24:34 +0100
Message-ID: <1901855998554.20020513212434@jenitennison.com>
To: Chuck Paussa <cpaussa@myrealbox.com>
CC: xmlschema-dev@w3.org
Hi Chuck,

> I'm trying to create a simpleType definition for length, which is
> defined as a real number plus a unit qualification. I've come up
> with this, which I know is wrong.
>    <simpleType name = "length_Type">
>        <restriction base = "NMTOKEN">
>            <pattern value = "[+-]?\d+\.?\d*[p|m|i|c|e][x|t|m|n]"/>
>        </restriction>
>    </simpleType>
> The unit qualification is one of px, pt, mm, in, cm, em so I
> constructed the above 2 part choice. The problem being it allows
> illegal values such as ix. How do I create a list of atoms greater
> than one character? [px|pt|mm|cm|in|em] is not right.

You need to use ()s rather than []s. The []s are used when you want to
say "one of this set of characters", so:


means one of p, m, i, c or e.

So you need:

<simpleType name="length_Type">
  <restriction base="NMTOKEN">
    <pattern value = "[+-]?\d+\.?\d*(px|pt|mm|cm|in|em)"/>



Jeni Tennison
Received on Monday, 13 May 2002 16:24:36 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:01 UTC