Next / Previous / Contents / Shipman's homepage

6.10. foRenderContent(): Render text and descendants into FO

The purpose of this function is to convert the text and children of a DocBook node into an XSL-FO representation. Note that this function does nothing with the .tail of the given node.

docbook5index
# - - -   f o R e n d e r C o n t e n t

def foRenderContent(foNode, docNode):
    '''Convert the content of a DocBook node into XSL-FO.

      [ (foNode is an FO container as an et.Element) and
        (docNode is a DocBook node as an et.Element) ->
          foNode  :=  foNode + (docNode.text if any) +
              (descendants of docNode with selected markup) ]
    '''

The rendered content always starts with the .text from the DocBook node.

docbook5index
    #-- 1
    # [ if foNode has any children ->
    #     foNode  :=  foNode with text added to the .tail
    #                  of its last child
    #   else ->
    #     foNode  :=  (foNode.text, if any) + docNode.text ]
    addText(foNode, docNode.text)

Processing the children of this node is handled in Section 6.11, “foRenderChild(): Convert one child node to FO”.

docbook5index
    #-- 2
    # [ foNode  :=  foNode + (descendants of docNode rendered
    #       as FO with selected markup) ]
    for child in docNode:
        #-- 2 body
        # [ foNode  :=  foNode + (child rendered as FO with
        #               selected markup) + child.tail ]
        foRenderChild(foNode, child)