|
Subject: Re: grouping elements From: Tony Graham <tgraham@xxxxxxxxxxxxxxxx> Date: Fri, 19 Feb 1999 13:14:21 -0500 (EST) |
At 19 Feb 1999 11:23 +0100, Bas Peters wrote:
> I have a stylesheet for database records that includes the following
> rules:
>
> (element MRCB100-c
> (make sequence
> (literal " ")
> (process-children)
> )
> )
>
> (element MRCB100-d
> (make sequence
> (literal " ")
> (process-children)
> )
> )
>
> (element MRCB100-e
> (make sequence
> (literal " ")
> (process-children)
> )
> )
>
> Is there a way to group the elements in one rule that repeates the
> literal statement for all elements and not for one element?
The experimental DSSSL extensions in recent versions of Jade (requires
"-2" on the Jade command line) includes or-element construction rules:
(or-element (MRCB100-c MRCB100-d MRCB100-e)
(sosofo-append
(literal " ")
(process-children)
)
)
(Note that sososfo-append will give a flatter flow object tree than
nesting sequence flow objects, but the difference in processing time
may not even be noticable.)
Another option is to use a procedure:
(define (add-space #!optional (children (process-children)))
(sosofo-append
(literal " ")
children)
)
)
(element MRCB100-c
(add-space)
)
Yet another option, especially if you have a lot of sibling elements
that all get the same treatment, is to process the elements in a
separate mode specified in the element construction rule of the parent
element of the siblings:
(element MRCB100
(with-mode add-space (process-children)))
(mode add-space
(default
(add-space)))
It's tempting to try:
(element MRCB100
(sosofo-append (node-list-map 'add-space (children (current-node)))))
but the procedure in node-list-map has to return a node-list, not a
sosofo.
Regards,
Tony Graham
======================================================================
Tony Graham mailto:tgraham@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9632
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| grouping elements, Bas Peters | Thread | RE: grouping elements, Didier PH Martin |
| Re: Indent problem, Tony Graham | Date | RE: grouping elements, Didier PH Martin |
| Month |