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

Noah (and various others) wrote:
> I understand that it may not meet the need, but there are many who
> would argue that:
>
>         <length units="cm">2.54</length>
>
> is better markup than:
>
>         <length> 2.54 cm</length>
>
> It's easier to manipulate with tools like XPath, XSL, and presumably
> Query, it can be more strongly typed. etc. Of course, since XML does
> not have structured attributes, it works only for elements. Still,
> it's worth considering if it meets your needs.

While I agree in general, Chuck did say (in an earlier message) that
he was trying to model XSL-FO data types. I believe that part of the
reason that XSL-FO doesn't separate length and unit is because it
didn't want to have to expand:

  space-before="2px 1cm 3in force retain"

into:

  <space-before>
    <minimum units="px">2</minimum>
    <optimum units="cm">1</optimum>
    <maximum units="in">3</maximum>
    <precedence>force</precedence>
    <conditionality>retain</conditionality>
  </space-before>

and that they wanted then to have consistency about how the "length"
data type was used throughout the markup language.
  
There are many cases in W3C and other markup languages where designers
have had to make a trade-off between processability and conciseness
and ended up on the side of conciseness. The data attribute of
svg:path springs to mind, as does XPath, and the xsi:schemaLocation
attribute.

It would be great if the next version of XML Schema provided more
support for these kinds of values.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Tuesday, 14 May 2002 08:40:03 UTC