Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-release > by-pkgid > 6b3585ea67ce3e79c9049b5b33294cdd > files > 638

docbook-style-dsssl-doc-1.79-16.mga7.noarch.rpm

<RefEntry id="expand-children">
<!-- This file is generated automatically from the DSSSL source. -->
<!-- Do not edit this file! -->
<?html-filename expand-children.html>

<RefMeta>
  <RefEntryTitle>expand-children</RefEntryTitle>
  <RefMiscInfo Role="file">dblib.dsl</RefMiscInfo>
</RefMeta>

<RefNameDiv>
  <RefName>expand-children</RefName>
  <RefPurpose>Expand selected nodes in a node list</RefPurpose>
</RefNameDiv>

<RefSynopsisDiv><Title>Synopsis</Title>
<Synopsis>
(expand-children nodelist gilist)
</Synopsis>
</RefSynopsisDiv>

<RefSect1><Title>Description</Title>

<para>
Given a node-list, <literal>expand-children</literal> replaces all of the members
of the node-list whose GIs are members of <literal>gilist</literal> with 
<literal>(children)</literal>.
</para>
<para>
This function can be used to selectively 
flatten the hierarchy of a document.</para>


</RefSect1>

<RefSect1><Title>Example</Title>

<para>
Suppose that the node list is <literal>(BOOKINFO PREFACE PART APPENDIX)</literal>.
<literal>(expand-children nl ("PART"))</literal> might return
<literal>(BOOKINFO PREFACE CHAPTER CHAPTER APPENDIX)</literal>.
</para>


</RefSect1>

<RefSect1><Title>Author</Title>

<para>
Norman Walsh, &lt;ndw@nwalsh.com&gt;
</para>
</RefSect1>
<RefSect1><Title>Source Code</Title>

<ProgramListing>
(define (expand-children nodelist gilist)
  ;; Expand selected nodes in a node list
  (let loop ((nl nodelist) (result (empty-node-list)))
    (if (node-list-empty? nl)
	result
	(if (member (gi (node-list-first nl)) gilist)
	    (loop (node-list-rest nl) 
		  (node-list result (children (node-list-first nl))))
	    (loop (node-list-rest nl)
		  (node-list result (node-list-first nl)))))))
</ProgramListing>
</RefSect1>

</RefEntry>