Checking for a potentially missing attribute

Subject: Checking for a potentially missing attribute
From: "Malcolm, Douglas J" <Douglas.Malcolm@xxxxxxxxx>
Date: Mon, 27 Mar 2000 14:41:48 -0500
Hi All,

Looks like something is amiss at mulberrytech - I'm trying to access the
archive of this list right now, and getting "You are not authorized to view
this page" errors.    

Anyway, I hope someone can shed some light on the problem I was trying to
lookup.  I have a pile of docs that contain <note> Some text </note> chunks.
Within <note> text, some have <title>'s, some do not.  Some just have the
title tag and no text.  

What I need to do:
1. If there is text in the title tags, pass it through and append ': '
2. If blank title tags, add 'NOTE: '
3. If no title tags at all, add 'NOTE: '

I have 1 & 2 working with this;

(element (note title)
  (if (equal? (data (current-node)) "")
      (make sequence
	font-weight: 'bold
	(literal "NOTE: "))
      (make sequence
	font-weight: 'bold
	(literal ": "))))

But #3 is proving more difficult.  I know I need something similar to the
'conditional numbering' discussion earlier.  This is what I have, and
obviously it isn't working:

(define (has-children? nd)
	(> 0 (node-list-length (select-elements (children nd) (gi nd))))

then the check on:

  (if (has-children? (current-node))

My trouble is in the (gi nd) section, I think.  How do I rewrite it to say
"With a gi of <title>"?  Or am I on completely the wrong track here?

Thank you!

Douglas Malcolm

 DSSSList info and archive:

Current Thread