prophetr
prophetr

Reputation: 1

Editing formatting for notices in DITA OT pdf plugin

I am new to DITA OT and trying to develop a custom pdf plugin. I have topics attached to a ditamap as topicrefs that have their otherprops='legal' and I am trying to get the pdf to print them before the TOC and on a different style master page. I assume that this is what the "notices" topic type exists for but please someone correct me if I'm wrong!

I have tried editing the determineTopicType template in commons.xsl to include an or statement that captures topicrefs on the map that have otherprops='legal' and then editing the processTopicNotices template to use new attribute sets which I then defined in commons-attr.xsl and topic-attr.xsl which has no visible effect.

I also tried to create a new master page and page-sequence and then apply those during topic processing but it seemed like topic notices was created to handle exactly this case so I gave up thinking I was trying to reinvent the wheel. Now I'm trying to use the notices feature to get it to print these topicrefs on notices pages and page-sequence. Below is the updated or statement added to the determineTopicType template and the processTopicNotices template.

        <xsl:template match="*[contains(@class, ' bookmap/notices ') or @otherprops='legal']" mode="determineTopicType">
        <xsl:text>topicNotices</xsl:text>
    </xsl:template>

    <xsl:template name="processTopicNotices">
        <xsl:variable name="atts" as="element()">
            <xsl:choose>
                <xsl:when test="key('map-id', ancestor-or-self::*[contains(@class, ' topic/topic ')][1]/@id)/ancestor::*[contains(@class,' bookmap/backmatter ')]">
                    <dummy xsl:use-attribute-sets="page-sequence.backmatter.notice"/> 
                </xsl:when>
                <xsl:otherwise>
                    <dummy xsl:use-attribute-sets="page-sequence.notice"/> 
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        <fo:page-sequence master-reference="body-sequence">
            <xsl:copy-of select="$atts/@*"/>
            <xsl:call-template name="startPageNumbering"/>
            <xsl:call-template name="insertPrefaceStaticContents"/>
            <fo:flow flow-name="xsl-region-body">
                <fo:block xsl:use-attribute-sets="notices">
                    <!-- TODO: Replace with mode="commonattributes" -->
                    <xsl:call-template name="commonattributes"/>
                    <xsl:if test="empty(ancestor::*[contains(@class, ' topic/topic ')])">
                        <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)[1]"
                            as="element()?"
                          />
                          <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="." mode="customTopicMarker"/>

                    <xsl:apply-templates select="*[contains(@class,' topic/prolog ')]"/>

                    <xsl:apply-templates select="." mode="insertChapterFirstpageStaticContent">
                        <xsl:with-param name="type" select="'notices'"/>
                    </xsl:apply-templates>

                    <fo:block xsl:use-attribute-sets="topic.title.notices">
                        <xsl:apply-templates select="." mode="customTopicAnchor"/>
                        <xsl:call-template name="pullPrologIndexTerms"/>
                        <xsl:apply-templates select="*[contains(@class,' ditaot-d/ditaval-startprop ')]"/>
                        <xsl:for-each select="*[contains(@class,' topic/title ')]">
                            <xsl:apply-templates select="." mode="getTitle"/>
                        </xsl:for-each>
                    </fo:block>

                    <xsl:choose>
                      <xsl:when test="$noticesLayout='BASIC'">
                          <xsl:apply-templates select="* except(*[contains(@class, ' topic/title ') or contains(@class,' ditaot-d/ditaval-startprop ') or
                              contains(@class, ' topic/prolog ') or contains(@class, ' topic/topic ')])"/>
                          <!--xsl:apply-templates select="." mode="buildRelationships"/-->
                      </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>
   </xsl:template>

Upvotes: 0

Views: 32

Answers (0)

Related Questions