[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Looking for (business) letter DTD ..



It seems odd, but I did not find such DTDs either.  I ended up writing a
simple DTD and DSSSL stylesheet for it.  Included below - letter.dtd and
letter.dsl.  HTH.

On Apr  8, Marc Baaden (baaden@smplinux.de) wrote:
 > 
 > Hi,
 > 
 > I am new to SGML, and have so far used it for simple
 > documentation with docbook.
 > 
 > I would like to try it for more day-to-day tasks,
 > like eg business letters. Unfortunately I couldn't
 > come up with any practical examples for this even
 > during a quite extensive websearch - maybe I just
 > used the wronk keywords ?
 > 
 > Or is SGML not recommended for such tasks ?
 > 
 > Any hints to example material is much appreciated.
 > If there was an existing debian package it would
 > even be better .. but I don't think I overlooked
 > that.

------------------------------------------------------------------------

<!-- letter.dtd -->
<!element letter - - (address, greeting, (para*), closing)>
<!element address - - (street, postal,date)>
<!element street - - (#pcdata)>
<!element postal - - (city, state, postalcode)>
<!element city - - (#pcdata)>
<!element state - - (#pcdata)>
<!element postalcode - - (#pcdata)>
<!element date - - (#pcdata)>
<!element greeting - - (#pcdata)>
<!element para - - (#pcdata|emph|strong)*>
<!element emph - - (#pcdata)>
<!element strong - - (#pcdata)>
<!element closing - - (xyz, name)>
<!element xyz - - (#pcdata)> <!-- What do you call "sincerely"? -->
<!element name - - (#pcdata)>

------------------------------------------------------------------------

<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

(root
    (make simple-page-sequence
      font-size: 14pt
      line-spacing: 14pt
      left-margin: 1in
      right-margin: 1in
      top-margin: 1in
      bottom-margin: 1in
      (process-children)))

(element (address)
  (make paragraph
    start-indent: 3in))

(element (street)
  (make paragraph
    (process-children)))

(element (postal)
  (make paragraph
    (process-children)))

(element (city)
  (make sequence
    (process-children)
    (literal ", ")))

(element (state)
  (make sequence
    (process-children)
    (literal " ")))

(element (postalcode)
  (make sequence
    (process-children)))

; (element (date)
;   (make paragraph
;     (process-children)))

; Make ISO 8601 format date in "Month #, ####" format date
(element (date)
  (make paragraph
    (literal
     (let* ((tstr (time->string (time)))
	    (yr (substring tstr 0 4))
	    (mo (list-ref
		 (list "January"
		       "February"
		       "March"
		       "April"
		       "May"
		       "June"
		       "July"
		       "August"
		       "September"
		       "October"
		       "November"
		       "December")
		 (-
		  (string->number
		   (if (string=? "0" (substring tstr 5 6))
		       (substring tstr 6 7)
		       (substring tstr 5 7)))
		  1)))
	    (dy (if (string=? "0" (substring tstr 8 9))
		    (substring tstr 9 10)
		    (substring tstr 8 10))))
       (string-append mo " " dy ", " yr)))))

(element (greeting)
  (make paragraph
    space-before: .2in
    space-after: .2in
    (process-children)))

(element (para)
  (make paragraph
    space-before: .2in
    space-after: .2in
    (process-children)))

(element (emph) ; emphasis within a para
  (make sequence
    font-posture: 'italic
    (process-children)))

(element (strong) ; strong emphasis within a para
  (make sequence
    font-weight: 'bold
    (process-children)))

(element (closing)
  (make paragraph
    start-indent: 3in
    (process-children)))

(element (xyz)
  (make paragraph
  space-before: .2in))

(element (name)
  (make paragraph
    space-before: .75in))

-- 
Neil L. Roeth



Reply to: