Reputation: 21
I have a dita XML with the following structure.
<bookmap>
<frontmatter><!-- FM content --></frontmatter>
<concept><!-- chapter content --></concept>
<concept><!-- chapter content --></concept>
<concept><!-- chapter content --></concept>
<concept><!-- chapter content --></concept>
<concept><!-- chapter content --></concept>
<concept><!-- chapter content --></concept>
<concept><!-- chapter content --></concept>
<concept><!-- chapter content --></concept>
</bookmap>
I need to have different header for only first page of first level the others are normal.
I used dita to pdf pluing static content for first page
<fo:static-content flow-name="first-body-header">
<fo:block xsl:use-attribute-sets="__body__odd__header">
<xsl:call-template name="getVariable">
<xsl:with-param name="id" select="'Body odd header'"/>
<xsl:with-param name="params">
<!-- <prodname>
<xsl:value-of select="$productName"/>
</prodname>-->
<heading>
<fo:inline xsl:use-attribute-sets="__body__odd__header__heading">
<fo:retrieve-marker retrieve-class-name="current-header"/>
</fo:inline>
</heading>
</xsl:with-param>
</xsl:call-template>
</fo:block>
</fo:static-content>
</xsl:template>
Unfortunately this template applies to all the first pages of all parts.
Have anyone faced this issue before. I want this header to be applicable only first page of first level
Thanks in advance
Arul
Upvotes: 2
Views: 168
Reputation: 13281
I am not sure about dita, but this issue is #8.5 under (Apache's) XSL-FO FAQ, and can be achieved (with fo resources) by something like:
<?xml version="1.0"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<!-- layout master set: -->
<fo:layout-master-set>
<!-- page master for 1st page -->
<!-- define a (e.g.) A4 page-master with extra 20mm header region for the first page -->
<fo:simple-page-master master-name="myFirst"
page-height="297mm" page-width="210mm"
margin-top="20mm" margin-bottom="20mm"
margin-left="25mm" margin-right="25mm">
<fo:region-body margin-top="20mm"/>
<fo:region-before region-name="myHeaderFirst" extent="20mm"/>
<!-- define custom footer with <fo:region-after/> ... -->
</fo:simple-page-master>
<!-- page master for "rest" page (body only) -->
<fo:simple-page-master master-name="myRest"
page-height="297mm" page-width="210mm"
margin-top="20mm" margin-bottom="20mm"
margin-left="25mm" margin-right="25mm">
<!-- define only/same body -->
<fo:region-body/>
</fo:simple-page-master>
<!-- Da page seekwendz masta! ..combining myFirst and myRest ;) -->
<fo:page-sequence-master master-name="myDocument">
<fo:repeatable-page-master-alternatives>
<!-- here comes fo magic: "page-position" in (first|last|rest|any|only)
..with precedence! -->
<fo:conditional-page-master-reference page-position="first"
master-reference="myFirst"/>
<fo:conditional-page-master-reference page-position="rest"
master-reference="myRest"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<!-- here go the contents/page sequences ... -->
<fo:page-sequence master-reference="myDocument">
<!-- static content BEFORE flow! (a small pitfall,
esp. when it is the footer not the header:)) -->
<fo:static-content flow-name="myHeaderFirst">
TODO : "print" your header for first page here.
</fo:static-content>
<!-- define other/more static-contents ... -->
<fo:flow flow-name="xsl-region-body">
TODO : "print" flow/body.
<!-- xsl:applyTemplates /-->
</fo:flow>
</fo:page-sequence>
</fo:root>
https://xmlgraphics.apache.org/fop (apache's fo-impl home)
https://www.data2type.de/en/xml-xslt-xslfo/xsl-fo/ (very detailed documentation on xsl-fo in en + de language)
Upvotes: 1