Subject: RE: Checking for a potentially missing attribute From: "Maltby, David G" <david.g.maltby@xxxxxxxx> Date: Mon, 27 Mar 2000 15:23:08 -0500 |
On Monday, March 27, 2000 2:42 PM, Malcolm, Douglas J [mailto:Douglas.Malcolm@xxxxxxxxx] wrote: > 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 > (process-children) > (literal "NOTE: ")) > (make sequence > font-weight: 'bold > (process-children) > (literal ": ")))) > > > But #3 is proving more difficult. I know I need something [snip] The element rule, (element (note title) ...), will not fire for the notes without titles, so your going to need solve #3 with an element rule (element notes ...). Such as (untested): (element note (if (has-child? "title") (process-children) ;the element rule for (note title) will fire ;else (make sequence font-weight: 'bold (process-children) (literal "NOTE: ") ) ) ) ;;; ; Standard Procedures ; http://www.mulberrytech.com/dsssl/dsssldoc/procedures/index.html ;;; ;;;has-child? ;Vivek Agrawala ; ;(has-child? gi snl) ; ;Returns #t if snl has a child node with GI gi. Returns #f otherwise. ; (define (has-child? gi snl) (not (node-list-empty? (select-elements (children snl) gi))) ) Hope this helps, Regards, David Maltby, IETM Team, Lockheed Martin Space Systems "Transforming instances conforming to one DTD into instances conforming to another DTD" (GKH) DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Checking for a potentially missing , Malcolm, Douglas J | Thread | Jade: How to get a "\tab" in the RT, baruchel |
Jade: How to get a "\tab" in the RT, baruchel | Date | Re: transformin CALS tables, Paul Tyson |
Month |