akapulko2020
akapulko2020

Reputation: 1139

Is there a way to create nested list in XSL-Fo format ?

I'd like the output to look like this :

 a. Pets' names and preferences
    i. Charlie
         1. Tuna
         2. Scratching   
   ii.  Fluffy
         1. Corn
         2. Running

But can't find a way to do it by way of nesting <fo:list-item>.

Upvotes: 0

Views: 1356

Answers (1)

Tony Graham
Tony Graham

Reputation: 8068

Nest fo:list-block inside fo:list-item-body.

fo:list-item-body (https://www.w3.org/TR/xsl11/#fo_list-item-body) can contain any of the %block; FOs (https://www.w3.org/TR/xsl11/#block.fo.list), and fo:list-block (https://www.w3.org/TR/xsl11/#fo_list-block) is one.

You'll end up with FOs nesting like:

fo:list-block
  fo:list-item
    fo:list-item-label
      fo:block
    fo:list-item-body
      fo:list-block
        fo:list-item
          fo:list-item-label
            fo:block
          fo:list-item-body
            fo:block
        fo:list-item
          fo:list-item-label
            fo:block
          fo:list-item-body
            fo:block
  fo:list-item
    fo:list-item-label
      fo:block
    fo:list-item-body
      fo:list-block
        fo:list-item
          fo:list-item-label
            fo:block
          fo:list-item-body
            fo:block
        fo:list-item
          fo:list-item-label
            fo:block
          fo:list-item-body
            fo:block

You'll need to correctly set provisional-distance-between-starts (https://www.w3.org/TR/xsl11/#provisional-distance-between-starts) and provisional-label-separation (https://www.w3.org/TR/xsl11/#provisional-label-separation) on each fo:list-block so that the list items are indented the way that you want.

Upvotes: 3

Related Questions