RE: The menu experiment

Subject: RE: The menu experiment
From: Peter Nilsson <pnidv96@xxxxxxxxxxxxx>
Date: Thu, 28 Jan 1999 16:38:44 +0100 (CET)
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
(declare-flow-object-class document-type "UNREGISTERED::James Clark//Flow Object Class::document-type")

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

(element breakfast-menu
    (make element
	  gi: "BODY"
	  attributes: '(("STYLE" "font-family:helvetica,sans

(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"
	     (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")

/Peter Nilsson

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

 DSSSList info and archive:

Current Thread