Re: Assign Element Value to Variable

Subject: Re: Assign Element Value to Variable
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxx>
Date: Thu, 13 Nov 1997 08:32:20 -0500
At 17:45 97/11/11 +0000, PSPARKES@xxxxxxxxxxxxx wrote:
>     1. I wish to output the following fragment with the contents of <TI2> 
>     before <TI1>:
>     
>     <Title>
>     <TI1>Slow=set aq. Bituminous emulsion contg. Alkaline soln. Of anionic 
>     emulsifier</TI1>
>     <TI2>Which is the reaction prod. of base and poly:carboxylic acid; or 
>     anhydride reaction prod. of unsatd. Fatty acid and or rosin=derived 
>     resin acid, etc.</TI2>
>     <AIT>AQUEOUS</AIT>
>     <STT>EMULSIFY</STT>
>     <STT>REACT</STT>
>     </Title>

The following example will accomplish the reording.  I've left the other
processing to you, but the following should be enough to follow the gist.

In this example the unnamed (default) processing node is not responsible
for the processing of <TI1> and <TI2>, because I wanted to not have to
explicitly process all of the children of <TITLE> in order (the order of
the remainder of the children might not be known or consistent).  I only
explicitly process the order of <TI1> and <TI2> and let the remainder of
the children be processed in whatever order is present.

I hope this helps.

..................... Ken


F:\FTEMP>type test.sgm
<!DOCTYPE title [
<!ELEMENT title - O ( ti1, ti2, ait, stt* )>
<!ELEMENT (ti1, ti2, ait, stt ) - O ( #PCDATA )>
]>
<Title>
<TI1>Slow=set aq. Bituminous emulsion contg. Alkaline soln. Of anionic 
emulsifier</TI1>
<TI2>Which is the reaction prod. of base and poly:carboxylic acid; or 
anhydride reaction prod. of unsatd. Fatty acid and or rosin=derived 
resin acid, etc.</TI2>
<AIT>AQUEOUS</AIT>
<STT>EMULSIFY</STT>
<STT>REACT</STT>
</Title>

F:\FTEMP>type test.dsl
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

(define debug
  (external-procedure "UNREGISTERED::James Clark//Procedure::debug"))

(define (show-element)             ;prefix data with GI for information
    (sosofo-append
        (literal (gi (current-node)))
        (literal ": ")
        (process-children)))

(element title
    (sosofo-append                  ;reorder title elements, then do all
        (with-mode ti (process-matching-children "TI2"))
        (with-mode ti (process-matching-children "TI1"))
        (process-children)))

(element TI1 (empty-sosofo))        ;ignore title elements in unnamed mode
(element TI2 (empty-sosofo))

(mode ti                            ;mode for title elements
    (element TI1 (show-element))
    (element TI2 (show-element)))

(default                            ;show everything else
    (show-element))

; end of file

F:\FTEMP>jade -c l:\jade\current\catalog test.sgm

F:\FTEMP>type test.fot
<!doctype fot public "-//James Clark//DTD DSSSL Flow Object Tree//EN">
<element index=0 rule-element>
<element index=2 mode=ti rule-element>
<chars>
TI2
</chars>
<chars>
: 
</chars>
<chars>
Which is the reaction prod. of base and poly:carboxylic acid; or 

</chars>
<chars>
anhydride reaction prod. of unsatd. Fatty acid and or rosin=derived 

</chars>
<chars>
resin acid, etc.
</chars>
</element>
<element index=1 mode=ti rule-element>
<chars>
TI1
</chars>
<chars>
: 
</chars>
<chars>
Slow=set aq. Bituminous emulsion contg. Alkaline soln. Of anionic 

</chars>
<chars>
emulsifier
</chars>
</element>
<element index=1 rule-element>
</element>
<element index=2 rule-element>
</element>
<element index=3 rule-default>
<chars>
AIT
</chars>
<chars>
: 
</chars>
<chars>
AQUEOUS
</chars>
</element>
<element index=4 rule-default>
<chars>
STT
</chars>
<chars>
: 
</chars>
<chars>
EMULSIFY
</chars>
</element>
<element index=5 rule-default>
<chars>
STT
</chars>
<chars>
: 
</chars>
<chars>
REACT
</chars>
</element>
</element>

F:\FTEMP>
F:\FTEMP>


--
G. Ken Holman            mailto:gkholman@xxxxxxxxxxxxxx
Crane Softwrights Ltd.  http://www.CraneSoftwrights.com
1605 Mardick Court, Box 266,         V: +1(613)489-0999
Kars, Ontario CANADA K0A-2E0         F: +1(613)489-0995
PGP Privacy: http://www.cyberus.ca/~holman/gkholman.pgp
Training:  http://www.CraneSoftwrights.com/schedule.htm

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


Current Thread