0

I am trying to convert a nested, bulleted list in HTML to XML-FO for output as a PDF in Apache FOP. The HTML looks like this

<ul>
   <li>Item Number1</li>
      <ul>
          <li>Sub-Item 1</li>
          <li>Sub-Item 2</li>
      </ul>
 </ul>

All of the XSLT I have tried creates a with an embedded for the subitems. FOP, however, complains that you can't have a list-block as a child of a list-block. Is this an issue with FOP? Or, is that simply not valid XML-FO and all of the XSLT examples are processing this construct incorrectly?

If it's the later, what is the proper XML-FO to produce a nested set of bullets like you would see in HTML?

Any help would be greatly appreciated!

Thanks!

user455889
  • 793
  • 2
  • 9
  • 14

1 Answers1

2

FOP is right to complain, the specification states a list-block cannot have a list-block as a child.

You need to create a ghost list item for the nested list, don't put a label on the item (thus making it a ghost item), and put the nested list into the body of the ghost item.

There is a helpful diagram on page 139 of my XSL-FO book that is available for free download on a "try and buy" basis at http://www.CraneSoftwrights.com/training/#pfux ... if you decide not to pay for the book, please delete the copy that you download for free.

G. Ken Holman
  • 4,333
  • 16
  • 14
  • Thanks, Ken. I also found that I could add the list-block to the parent bullet item by inserting it before the closing list-item-body tag. Now I just need to figure out how to get the XSL to that. It wants to close previous item before putting the next list-block which is where the problem lies. I'll definitely look at your book! – user455889 Apr 05 '14 at 02:54