RE: The menu experiment

Subject: RE: The menu experiment
From: "Didier PH Martin" <martind@xxxxxxxxxxxxx>
Date: Thu, 28 Jan 1999 19:53:57 -0500
HI Peter,

When I tried the script the output did not had the <HTML> declaration.

Here is the output I got:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0">

  Belgian Waffles - $5.95two of our famous Belgian waffles with plenty of
real maple syrupcalories per serving650
  Strawberry Belgian Waffles - $7.95light Belgian waffles covered with
strawberries and whipped creamcalories per serving900
  Berry-Berry Belgian Waffles - $8.95light Belgian waffles covered with an
assortment of fresh berries and whipped creamcalories per serving900
  French Toast - $4.50thick slices made from our homemade sourdough
breadcalories per serving600
  Homestyle Breakfast - $6.95two eggs, bacon or sausage, toast, and our
ever-popular hash brownscalories per serving950

-----Original Message-----
From: owner-dssslist@xxxxxxxxxxxxxxxx
[mailto:owner-dssslist@xxxxxxxxxxxxxxxx]On Behalf Of Peter Nilsson
Sent: Thursday, January 28, 1999 10:39 AM
To: dssslist@xxxxxxxxxxxxxxxx
Subject: RE: The menu experiment


On Wed, 27 Jan 1999, Didier PH Martin wrote:

> I works! I now have exactly the same output as the XSL script. I modified
> two rules
>
> (element description
>   (make element
>             gi: "DIV"
>             attributes: '(("STYLE"
>               "margin-left:20px;margin-bottom:1em;font-size:10pt;"))
>      (make sequence
>         (process-children)
>         (process-node-list (select-elements (children (parent
> (current-node))) "calories" )))))
>
> (element calories
>     (make element
> 	   gi: "SPAN"
> 	   attributes: '(("STYLE" "font-style:italic"))
> 	   (literal " (")
> 	   (process-children)
> 	   (literal " calories per serving)") ))
>

Here is another modified version of your style sheet. This one might be
clearer. Instead of taking the parens child named calories in the rule for
the description, I make the DIV element in the food rule. I think this is
more straight forward to read. (BTW I added a document-type, which makes
the generated markup more HTML-compliant.)

The style sheet:
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">
(declare-flow-object-class element "UNREGISTERED::James Clark//Flow Object
Class::element")
(declare-flow-object-class document-type "UNREGISTERED::James Clark//Flow
Object Class::document-type")

(root
    (make sequence
      (make document-type
	name: "HTML"
	public-id: "-//W3C//DTD HTML 4.0")
      (make element
	gi: "HTML"
	(process-children))))

(element breakfast-menu
    (make element
	  gi: "BODY"
	  attributes: '(("STYLE" "font-family:helvetica,sans
sherif;font-size:12pt;background-color:#EEEEEE"))
        (process-children)))

(element food
	(make display-group
	   (make element
		  gi: "DIV"
		  attributes: '(("STYLE" "background-color:teal;color:white;padding:4px"))
         	 (process-matching-children "name")
		 (literal " - ")
		 (process-matching-children "price"))
	   (make element
	     gi: "DIV"
	     attributes:
	     '(("STYLE"
		"margin-left:20px;margin-bottom:1em;font-size:10pt;"))
	     (process-matching-children "description")
	     (process-matching-children "calories"))))

(element name
    (make element
	  gi: "SPAN"
	  attributes: '(("STYLE" "font-weight:bold;color:white")) ))

;; Is the following really necessary?
(element price
    (make sequence))

;; The rule for description is removed.

(element calories
    (make element
	   gi: "SPAN"
	   attributes: '(("STYLE" "font-style:italic"))
	   (literal "calories per serving")
	   (process-children)))

Regards,
/Peter Nilsson

--
'(?P . (?e . (?t . (?e . (?r)))))


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


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


Current Thread