(dsssl) If no P children?

Subject: (dsssl) If no P children?
From: Tim McDaniel <tmcd@xxxxxxxxx>
Date: Sun, 16 Mar 2003 02:41:35 -0600 (CST)
The input looks like

    <item decision="accepted">
    <name>Juliana de Ravenshagh</name>
    <action>Name and device</action>
    <armory>Per chevron inverted vert and argent, an angel argent and two stick hobbyhorses in saltire sable</armory>
    </item>

for a decision without any explanatory discussion needed, or

    <item decision="returned">
    <name>Grettir h&#225;lfskegg</name>
    <action>Name</action>
    <discussion> <name-discussion>

    <p>This submission was withdrawn by the submitter.</p>

    </name-discussion></discussion> </item>

for a decision where an explanatory discussion was needed.

The current processing is this when producing HTML (snipped
irrelevancies):

    (element item
      (make sequence
        (make element gi: "dt"
              (make element gi: "a" [...stuff...]
                  (process-matching-children 'name))
              (process-matching-children 'action)
              (process-matching-children 'armory)
              ) ;; make element dt
        (make element gi: "dd"
              (process-matching-children 'discussion)
              ) ;; make element dd
        ) ;; make sequence
      ) ;; make element item

So that produces (where uppercase refers to the results of processing
children):

    <dt><a [...stuff...]>NAME</a> ACTION  ARMORY</dt>
    <dd>DISCUSSION</dd>

That's all very well and good when there is text in the discussion.
The misfeature is when there isn't.  You get things like

    <dt><a [...stuff...]>NAME</a> ACTION  ARMORY</dt>
    <dd></dd>

    <dt><a [...stuff...]>NAME</a> ACTION  ARMORY</dt>
    <dd></dd>

The browsers I've seen have nice inter-item vertical space around dd
blocks that have text in them (a blank line above and below).  If it's
empty, though, such an entry abuts its neighbors, like

    Juliana de Ravenshagh. Name and device. Per chevron inverted vert
    and argent, an angel argent and two stick hobbyhorses in saltire
    sable.
    Melisant atte Mersche. Name.
    Róis inghean uí Dhubhshláine. Name.
    ...

which I find a bit displeasing.  What I would like to do is, instead
of

        (make element gi: "dd"
              (process-matching-children 'discussion)
              ) ;; make element dd

to have

        (make element gi: "dd"
              (if ANY DESCENDANT OF THIS ITEM IS A <P>
                  (process-matching-children 'discussion
                  (literal "&nbsp;")
              ) ;; make element dd

(It is theoretically possible to have a <discussion> element with no
text in it -- the DTD allows it -- so I do not want to just look for a
child of type discussion.)  (When I use "type" there, is the proper
term "gi"?)  How do I code the if test?

-- 
Tim McDaniel (home); Reply-To: tmcd@xxxxxxxxx; work is tmcd@xxxxxxxxxxx

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

Current Thread