Need to change the footer value as per the parent and child topic attributes
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 9
- Joined: Thu Oct 24, 2019 2:43 pm
Need to change the footer value as per the parent and child topic attributes
Post by boopathyks »
Hi,
Now I'm working on creating the footer value for pdf using dita-ot pdf conversion. I'm having single parent topic with multiple child topics with outputclass attribute and I need to create the footer text for certain child topic
Input Dita Having:
I have created the customized footnote for the pdf using static-content.xsl
Now I'm getting DEF as footer for all the topics, but I need each child topic gets their corresponding footer value. Seems like it allowing only one topic for the footer. Please help me to get the footer value for each child topics. Thanks in advance!!!
Now I'm working on creating the footer value for pdf using dita-ot pdf conversion. I'm having single parent topic with multiple child topics with outputclass attribute and I need to create the footer text for certain child topic
Input Dita Having:
Code: Select all
[i]<topic class="- topic/topic " [b]outputclass="heading"[/b]>
<title outputclass="CD_Map_Heading-hide">HIDE TOPIC</title>
<topic class="- topic/topic " [b]outputclass="DEF"[/b]>
<title>DEFINITION</title>
</topic>
<topic class="- topic/topic " [b]outputclass="REV"[/b]>
<title>REVOLUTION</title>
</topic>
</topic>[/i]
Code: Select all
<xsl:template name="insertBodyOddFooter">
<fo:static-content flow-name="odd-body-footer">
<fo:block> </fo:block>
<fo:block xsl:use-attribute-sets="__body__odd__footer">
<xsl:choose>
<xsl:when test="*[contains(@outputclass, 'DEF')]">
<xsl:text>DEF</xsl:text>
</xsl:when>
<xsl:when test="*[contains(@outputclass, 'REV')]">
<xsl:text>REV</xsl:text>
</xsl:when>
<xsl:otherwise>
<fo:block-container position="absolute">
<fo:block padding-top="20pt" text-align="center">
<fo:page-number/>
</fo:block>
</fo:block-container>
</xsl:otherwise>
</xsl:choose>
</fo:block>
</fo:static-content>
</xsl:template>
-
- Posts: 501
- Joined: Mon Feb 03, 2003 10:56 am
Re: Need to change the footer value as per the parent and child topic attributes
The template insertBodyOddFooter is called once, from the start of a fo:page-sequence.
The content it generates is static across the entire page sequence.
There are a couple of solutions:
1. force the publishing process to create new fo:page-sequences for each of the topics you need to customize. This is not a trivial task and requires heavily changing DITA XSL-FO stylesheets.
2. use a special kind of variables (fo:markers) that are expanded by the FO processor in the static content of the page.
For the second solution: In your XSL customization overwrite the template that matches the title of a topic, then add an fo:marker next to the content it generates.
This variable you can use later in the insertBodyOddFooter template, by using a fo:retrieve-marker.
Another option would be to use the CSS based PDF transformation that is available in oXygen, is much easier to add text that is expanded in the footer, by using string sets ( a kind of variables). Here is a CSS snippet:
You can read more about customizing the PDF-CSS transformation here: https://www.oxygenxml.com/doc/versions/ ... n_css.html
The content it generates is static across the entire page sequence.
Code: Select all
<xsl:template name="processTopicPart">
<fo:page-sequence master-reference="body-sequence" xsl:use-attribute-sets="page-sequence.part">
<xsl:call-template name="startPageNumbering"/>
<!-- The header and footer are inserted before the flow of topics -->
<xsl:call-template name="insertBodyStaticContents"/>
<fo:flow flow-name="xsl-region-body">
<!-- Here comes the list of fo elements for all the topics -->
1. force the publishing process to create new fo:page-sequences for each of the topics you need to customize. This is not a trivial task and requires heavily changing DITA XSL-FO stylesheets.
2. use a special kind of variables (fo:markers) that are expanded by the FO processor in the static content of the page.
For the second solution: In your XSL customization overwrite the template that matches the title of a topic, then add an fo:marker next to the content it generates.
This variable you can use later in the insertBodyOddFooter template, by using a fo:retrieve-marker.
Code: Select all
<xsl:template match="*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/title ')]">
<xsl:next-match/>
<xsl:choose>
<xsl:when test="../[contains(@outputclass,'DEF')]">
<fo:marker marker-class-name="var">DEF</fo:marker>
</xsl:when>
<xsl:when test="../[contains(@outputclass,'REV')]">
<fo:marker marker-class-name="var">REV</fo:marker>
</xsl:when>
<xsl:otherwise>
<fo:marker marker-class-name="var"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="insertBodyOddFooter">
<fo:static-content flow-name="odd-body-footer">
<fo:block> </fo:block>
<fo:block xsl:use-attribute-sets="__body__odd__footer">
<!-- THE FO PROCESSOR WILL USE THE MARKER ON EACH FOOTER IT GENERATES -->
<fo:retrieve-marker retrieve-class-name="var"/>
<fo:block-container position="absolute">
<fo:block padding-top="20pt" text-align="center">
<fo:page-number/>
</fo:block>
</fo:block-container>
</fo:block>
</fo:static-content>
</xsl:template>
Code: Select all
*[class~= "topic/topic"][outputclass ~= "DEF"]{
string-set: var "DEF";
}
*[class~= "topic/topic"][outputclass ~= "REV"] {
string-set: var "REV";
}
*[class~= "topic/topic"][not(outputclass)] {
string-set: var '';
}
@page chapter:right, chapter:left{
@bottom-center {
content: "Text that changes: " string('var')
}
}
-
- Posts: 9
- Joined: Thu Oct 24, 2019 2:43 pm
Re: Need to change the footer value as per the parent and child topic attributes
Post by boopathyks »
Thanks Dan!!!! Its working well
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service