DITA OT PDF插件通知格式定制:legal属性主题前置打印
DITA OT自定义PDF插件开发问题
我是DITA OT新手,正在开发自定义PDF插件。我的ditamap中有设置otherprops='legal'的topicrefs关联主题,希望将这些主题在目录(TOC)前用不同的母版页打印。我认为这正是notices主题类型的用途,若有误请指正!
我尝试过以下操作,但没有可见效果:
- 修改
commons.xsl中的determineTopicType模板,添加或条件以捕获map中含otherprops='legal'的topicrefs - 修改
processTopicNotices模板使用新属性集 - 在
commons-attr.xsl和topic-attr.xsl中定义这些属性集
我也曾尝试创建新母版页和页面序列并在主题处理时应用,但觉得topic notices功能正是为此场景设计,遂放弃避免重复造轮子。目前我正尝试利用notices功能让这些topicrefs在通知页面和页面序列中打印。以下是更新后的代码:
<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>
内容的提问来源于stack exchange,提问作者prophetr
相关产品推荐
相关产品推荐

