string->quantity ?

Subject: string->quantity ?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 23 Jul 1998 17:09:06 +0100
dsssl provides a string->number function to convert a string to a
number, but what I need is conversion to a length.

Mainly because I want to get ``3pt''

from here:
          <mspace width="3pt">
to here:
          (make line-field 
                field-width: 3pt)

by way of attribute-string.

I did find something that would work, namely the function
measurement-to-length
in the docbook library (Ever a life saver!), in the  file dblib.dsl but
that works by parsing the string `by hand' in dsssl code, to extract the
digits, and then looking up the remaining characters in a dsssl alist of
unit conversions eg  "mm" -> 1mm.

Not that I want to cast doubt on Norm's code but is that really the only
way?

David


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread
  • string->quantity ?
    • David Carlisle - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id LAA12835Thu, 23 Jul 1998 11:06:53 -0400 (EDT) <=