One Chapter/Topic with different overall formatting in a Bookmap

Here should go questions about transforming XML with XSLT and FOP.
Posts: 21
Joined: Wed Nov 18, 2015 6:43 pm

One Chapter/Topic with different overall formatting in a Bookmap

Post by josecotes » Wed Dec 09, 2015 6:43 pm

Hi there,

I have a Bookmap with the structure as below:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<bookmap xml:lang="en">
<part format="dita" href="Part1.xml"/>
<chapter format="ditamap" href="Section1-1.ditamap"/>
<chapter format="ditamap" href="Section2-2.ditamap"/>
<chapter format="ditamap" href="Section3-3.ditamap"/>
<part format="ditamap" href="Part2.ditamap"/>
<part format="ditamap" href="Part3.ditamap"/>
<part format="ditamap" href="Part4.ditamap"/>
<appendix format="ditamap" href="AppendixA.ditamap"/>
My question is, for those chapters inside part1, can I format them differently than the rest of the topics/parts in the rest of the books?

I was thinking about adding an outputclass to those as follows:

Code: Select all

		<chapter format="ditamap" href="Section1-1.ditamap" outputclass="section"/>
<chapter format="ditamap" href="Section2-2.ditamap" outputclass="section"/>
<chapter format="ditamap" href="Section3-3.ditamap" outputclass="section"/>
Then in file attr-set-reflection.xsl, I found the section that triggers the topics styles, i.e.:

Code: Select all

<xsl:when test="$attrSet = 'topic.topic.topic.title'">
<xsl:call-template name="new-attr-set-reflection">
<xsl:with-param name="temp-element">
<xsl:element name="placeholder" use-attribute-sets="topic.topic.topic.title"/>
Are these the sections where i have to put a conditional for this to work?

I will create new attrributes/styles, i.e. section.topic.topic.topic.title, but how do I add the conditional into attr-set-reflection.xsl and is this the right approach?

Thanks for all your help,

Posts: 377
Joined: Thu Aug 21, 2003 11:36 am
Location: Craiova

Re: One Chapter/Topic with different overall formatting in a Bookmap

Post by radu_pisoi » Fri Dec 11, 2015 3:26 pm

Maybe another solution is to override the template processTopicChapter from commons.xsl. This is the template used to process chapters from a bookmap.

In this template you should check if the current topic has the output class that you previously set. To accomplish that, you should verify if the input document contains a chapter with the same id as the current processed topic and also with the specified output class. The XPath condition: //chapter[@id=$cTopic/@id][@outputclass='section'] where $cTopic is the current processed topic. Please see that stage1a.xml file from the temporary folder. It is used as input for this transformation.

If all the above condition are fulfilled, you could style the current chapter as you wish by adding your custom attribute sets.
Radu Pisoi
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger

Post Reply