Skip to content
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

Processing only works on chapter level #2

Open
stefan-jung opened this issue Jun 7, 2021 · 1 comment
Open

Processing only works on chapter level #2

stefan-jung opened this issue Jun 7, 2021 · 1 comment

Comments

@stefan-jung
Copy link

stefan-jung commented Jun 7, 2021

This only works on <chapter> level. This might be insufficient, e.g. in multilanguage deliverables.

English <!-- Chapter level -->
  Chapter 1 <!-- Topic level -->
  Chapter 2 <!-- Topic level -->
  Chapter 3 <!-- Topic level -->
German <!-- Chapter level -->
  Chapter 1 <!-- Topic level -->
  Chapter 2 <!-- Topic level -->
  Chapter 3 <!-- Topic level -->

When trying to apply this on <topic> level, I get the following error:

org.apache.fop.apps.FOPException: net.sf.saxon.trans.XPathException: org.apache.fop.fo.ValidationException:
"fo:page-sequence" is not a valid child of "fo:block"! (See position 12:2606)
net.sf.saxon.trans.XPathException: org.apache.fop.fo.ValidationException: "fo:page-sequence" is not a valid child of 
"fo:block"! (See position 12:2606)

To trigger this, you can avoid triggering processTopicChapterInsideFlow by replacing

<xsl:apply-templates select="." mode="processTopicChapterInsideFlow"/>

with

<fo:page-sequence
	master-reference="{if (@outputclass) then (concat(@outputclass, '-sequence')) else 'body-sequence'}"
	xsl:use-attribute-sets="page-sequence.body">
	<xsl:call-template name="startPageNumbering"/>
	<xsl:call-template name="insertBodyStaticContents"/>
	<fo:flow flow-name="xsl-region-body">
		<fo:block xsl:use-attribute-sets="topic">
			<xsl:call-template name="commonattributes"/>
			<xsl:variable name="level" as="xs:integer">
				<xsl:apply-templates select="." mode="get-topic-level"/>
			</xsl:variable>
			<xsl:if test="$level eq 1">
				<fo:marker marker-class-name="current-topic-number">
					<xsl:variable name="topicref" select="key('map-id', ancestor-or-self::*[contains(@class, ' topic/topic ')][1]/@id)"/>
					<xsl:for-each select="$topicref">
						<xsl:apply-templates select="." mode="topicTitleNumber"/>
					</xsl:for-each>
				</fo:marker>
				<xsl:apply-templates select="." mode="insertTopicHeaderMarker"/>
			</xsl:if>
			
			<xsl:apply-templates select="*[contains(@class,' topic/prolog ')]"/>
			
			<xsl:apply-templates select="." mode="insertChapterFirstpageStaticContent">
				<xsl:with-param name="type" select="'chapter'"/>
			</xsl:apply-templates>
			
			<fo:block xsl:use-attribute-sets="topic.title">
				<xsl:call-template name="pullPrologIndexTerms"/>
				<xsl:for-each select="*[contains(@class,' topic/title ')]">
					<xsl:apply-templates select="." mode="getTitle"/>
				</xsl:for-each>
			</fo:block>
			
			<xsl:choose>
				<xsl:when test="$chapterLayout='BASIC'">
					<xsl:apply-templates select="*[not(contains(@class, ' topic/topic ') or contains(@class, ' topic/title ') or
						contains(@class, ' topic/prolog '))]"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:apply-templates select="." mode="createMiniToc"/>
				</xsl:otherwise>
			</xsl:choose>
			
			<xsl:apply-templates select="*[contains(@class,' topic/topic ')]"/>
			<xsl:call-template name="pullPrologIndexTerms.end-range"/>
		</fo:block>
	</fo:flow>
</fo:page-sequence>
@raducoravu
Copy link
Contributor

Thanks @xephon2 we are not interested that much in XSL-FO based customizations any more having invested in CSS based PDF publishing which makes it very easy to change the layout on any DITA element.
But I will leave this issue opened, maybe others are interested in your fix details. Or you can open a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants