Sometimes you have to deal with the rats in the attic.
A coworker dropped by to brainstorm a perplexing problem he noticed in the report he was working on. The report is a PDF document generated from XML using XSLT and Apache FOP. An index table appears on the last page of the report, listing the name and page number of each section in the report. All of the sections were listed with the correct page number, except the section output on page 2 of the report, which the index showed as starting on page 1.
After tracing through the legacy XSLT code for a couple of minutes, we realized that the section start was flagged in the XSL-FO code in an "invisible" table that happened to come out at the very bottom of page 1, forcing the "visible" table over to page 2. Thus the table of contents correctly but deceptively showed the section starting on page 1. The code base that generates this report is several years old, and it has gone through multiple hands, as such code often does, so we had no idea why the original designers chose to output the section start flag in this way.
We came up with a couple of possible fixes he could to try, like eliminating the "invisible" table and moving the flag into the visible table, or if the invisible table was really necessary, apply a "keep with next" attribute so it would always stick to its corresponding section.
My coworker then said the problem reminded him of a scene from Bad Boys 2 (caution, link is not PG or SFW!), wherein Cuban drug lord Johnny Tapia, crawling through the attic where he stashed a mountain of stolen cash, discovers a nest of huge rats gnawing through the piles of loot. After blasting the rats with a cannon-sized revolver, Tapia exclaims to his henchman, "Carlos, this is a stupid f****ing problem to have, but, it is a problem, nonetheless!"
Excuse the language, but it is funny.ReplyDelete
Good find Alre! I'll correct the quote.ReplyDelete