AntennaHouse / pdf5-ml

Antenna House PDF5-ML DITA-OT Plug-in
23 stars 9 forks source link

break-before column except first child #201

Closed steinbacher01 closed 3 years ago

steinbacher01 commented 3 years ago

I'm working on a custom doc-type that has multiple columns for atsChapterHead2 and lower. I'd like the columns to break before each level 2 heading, except for the first child.

I found a parameter to supress first child page break, but I can't find the template where it is applied.

Any suggestions on the best way to implement this for column breaks?

Thanks,

Leroy Steinbacher

ToshihikoMakita commented 3 years ago

Could you send me the minimum test data with comments?

steinbacher01 commented 3 years ago

I figured out a way to do this. I added the following to the genChapterTitle template in dita2fo_title.xsl.

I created a variable to count preceding siblings

<xsl:variable name="siblings" select="count($prmTopicRef/preceding-sibling::*[contains(@class, ' map/topicref ')])"/>

Then I created a style for ChapterHead2-not-first and applied it to all siblings except the first one.

<xsl:when test="$level eq 2 and not($siblings eq 0)">
    <xsl:sequence select="'atsChapterHead2-not-first'"/>
</xsl:when>

This allows me to add break-before column for all ChapterHead2 except first one.

<attribute-set name="atsChapterHead2-not-first" use-attribute-sets="atsChapterHead2" doc-type="IFU">
   <attribute name="break-before">column</attribute>
</attribute-set>

Seems to work pretty good. Now I get a column break for each heading level 2 except for the first one.

Just curious if there is a better way to do this.

Thanks,

Leroy Steinbacher

ToshihikoMakita commented 3 years ago

Great! I think you got the point.