New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support root level grouping topicrefs #2092 #2648 #2614 #2683
Conversation
@@ -240,6 +238,19 @@ See the accompanying LICENSE file for applicable license. | |||
<xsl:call-template name="createBackCover"/> | |||
</xsl:template> | |||
|
|||
<xsl:template match="*[contains(@class,' map/topicref ')]" mode="generatePageSequenceFromTopicref"> | |||
<xsl:choose> | |||
<xsl:when test="empty(key('topic-id', @id))"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Save key('topic-id', @id)
into a variable since it's used twice in this template.
<xsl:call-template name="processTopicChapter"/> | ||
</xsl:for-each> | ||
<xsl:choose> | ||
<xsl:when test="empty(key('topic-id', @id))"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as previous comment, save key('topic-id', @id)
into e.g. $topic
variable. Applies to all cases below.
574120b
to
2b10b12
Compare
Signed-off-by: Robert D Anderson <robander@us.ibm.com>
Now updated based on review comments from @jelovirt |
The current PDF2 process assumes that if a root branch of a map has any real content, the root
topicref
of the branch will have either a title or reference a topic (or both). When that is not the case, the PDF is broken. If there is only the one root branch, FOP will crash (as reported in #2648). If there are "valid" root branches, the branch with a root grouping element will appear in the TOC + contents but not in the actual content.Related, the much older issue #2092 has the same root cause -- it assumes that in a bookmap, any
chapter
,appendix
,appendices
,preface
, ortopicref
(as child of front/back matter container) will either have a title or reference a topic. When that is not the case, results are the same as above.In all of these cases, the code assumes that the container elements will reference a topic, and try to process the topic with
<xsl:for-each select="key('topic-id', @id)">
(note that when there is only a title in thetopicref
/chapter
/ etc, the merge process generates a topic with that title, so the key-lookup still works). When thetopic-id
lookup fails, no page sequence is generated, and children are not processed.The fix here checks to see if the
topic-id
returns anything. If the result is empty, it continues to anytopicref
children with the same mode. Additional groupingtopicref
elements do the same. If a topic is eventually found, a valid page sequence is generated, and normal processing continues at that point.Just realized that this also addresses #2614.
Signed-off-by: Robert D Anderson robander@us.ibm.com