title numbering in PDF2 moving from Oxygen Author 13 to Oxygen Author 14.1
Posted: Fri Feb 01, 2013 7:24 pm
I had a customization, mainly in the commons.xsl code in Oxygen 13 that would add leading numbers in headings for PDF output.
For example:
1.1 Chapter One, First Heading
1.2 Chapter One, Second Heading
1.2.1 Chapter One, First Subheading of Second Heading
1.2.2 Chapter One, Second Subheading of Second Heading
.....
2.1 Chapter Two, First Heading
2.2 Chapter Two, Second Heading
... and so forth.
It worked well with Oxygen 14.1, but now customizing the commons.xsl using the same code:
<!-- François Masson 08-23-2012 Outline numbering -->
<!-- Maximum level to which Topic titles are numbered. See "getTitleNumber" template below -->
<xsl:variable name="topicTitle.numLevel">6</xsl:variable>
<!-- getNonumTitle template is a copy of the original getTitle
template that will be used for titles that should not be numbered. -->
<xsl:template name="getNonumTitle"><!-- get fully-processed title content by
whatever mechanism -->
<xsl:choose>
<!-- add keycol here once implemented-->
<xsl:when test="@spectitle">
<xsl:value-of select="@spectitle"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- getTitle template override. See demo\fo\xsl\fo\commons.xsl -->
<xsl:template name="getTitle">
<!-- get fully-processed title content by whatever mechanism -->
<xsl:variable name="titleNumber">
<!--Add title numbers to topic titles ONLY-->
<xsl:if test="parent::*[contains(@class,'topic/topic')]">
<xsl:call-template name="getTitleNumber" />
</xsl:if>
</xsl:variable>
<xsl:choose>
<!-- add keycol here once implemented-->
<xsl:when test="@spectitle">
<xsl:value-of select="@spectitle" />
</xsl:when>
<!-- Suppress numbering of the glossary -->
<xsl:when test="parent::*[contains(@class,'topic/topic')][@id =
//*/glossarylist/@id]">
<xsl:apply-templates />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$titleNumber" />
<xsl:apply-templates />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Number topics down to level = $topicTitle.numLevel -->
<xsl:template name="getTitleNumber">
<!-- Find the -->
<xsl:variable name="level"
select="ancestor::*[contains(@class,' topic/topic ')]" />
<xsl:variable name="appendix"
select="//*[contains(@class,' bookmap/appendix ')]" />
<xsl:choose>
<xsl:when test="count($level)=1 and parent::*/@id[. = //*/chapter/@id]">
<xsl:for-each select="$level">
<xsl:value-of
select="count(preceding-sibling::*[contains(@class,' topic/topic ')]) + 1"
/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:when>
<xsl:when test="count($level)=1 and parent::*/@id[. = //*/appendix/@id]">
<!-- from="*[contains(@class,' topic/topic ')][@id[. = $appendix[1]/@id]"-->
<!-- <xsl:number level="multiple" format="A"/>-->
<xsl:for-each select="$level">
<xsl:number
value="count(preceding-sibling::*[contains(@class,' topic/topic ')][@id =
//*/appendix/@id]) + 1"
format="A"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:when>
<xsl:when
test="not(count($level) > $topicTitle.numLevel) and ancestor::*/@id[. =
//*/appendix/@id]">
<xsl:number
count="*[contains(@class,' topic/topic ')][@id =
//*/appendix/@id|//*/topicref/@id]"
level="multiple" format="A.1" />
<xsl:text> </xsl:text>
</xsl:when>
<xsl:when test="not(count($level) > $topicTitle.numLevel)">
<xsl:number count="*[contains(@class,' topic/topic ')]"
level="multiple" format="1.1" />
<xsl:text> </xsl:text>
</xsl:when>
<xsl:otherwise />
<!-- no title numbering at nth level where n > $topicTitle.numLevel -->
</xsl:choose>
</xsl:template>
<xsl:template match="*" mode="getTitle">
<xsl:choose>
<!-- add keycol here once implemented-->
<xsl:when test="@spectitle">
<xsl:value-of select="@spectitle"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
does not add leading numbers in headings for PDF output.
I don't get errors, and the PDF gets built, but not showing leading numbers.
Any idea how I can get leading numbers in the pdf with the new org.dita.pdf2?
Thanks
For example:
1.1 Chapter One, First Heading
1.2 Chapter One, Second Heading
1.2.1 Chapter One, First Subheading of Second Heading
1.2.2 Chapter One, Second Subheading of Second Heading
.....
2.1 Chapter Two, First Heading
2.2 Chapter Two, Second Heading
... and so forth.
It worked well with Oxygen 14.1, but now customizing the commons.xsl using the same code:
<!-- François Masson 08-23-2012 Outline numbering -->
<!-- Maximum level to which Topic titles are numbered. See "getTitleNumber" template below -->
<xsl:variable name="topicTitle.numLevel">6</xsl:variable>
<!-- getNonumTitle template is a copy of the original getTitle
template that will be used for titles that should not be numbered. -->
<xsl:template name="getNonumTitle"><!-- get fully-processed title content by
whatever mechanism -->
<xsl:choose>
<!-- add keycol here once implemented-->
<xsl:when test="@spectitle">
<xsl:value-of select="@spectitle"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- getTitle template override. See demo\fo\xsl\fo\commons.xsl -->
<xsl:template name="getTitle">
<!-- get fully-processed title content by whatever mechanism -->
<xsl:variable name="titleNumber">
<!--Add title numbers to topic titles ONLY-->
<xsl:if test="parent::*[contains(@class,'topic/topic')]">
<xsl:call-template name="getTitleNumber" />
</xsl:if>
</xsl:variable>
<xsl:choose>
<!-- add keycol here once implemented-->
<xsl:when test="@spectitle">
<xsl:value-of select="@spectitle" />
</xsl:when>
<!-- Suppress numbering of the glossary -->
<xsl:when test="parent::*[contains(@class,'topic/topic')][@id =
//*/glossarylist/@id]">
<xsl:apply-templates />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$titleNumber" />
<xsl:apply-templates />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Number topics down to level = $topicTitle.numLevel -->
<xsl:template name="getTitleNumber">
<!-- Find the -->
<xsl:variable name="level"
select="ancestor::*[contains(@class,' topic/topic ')]" />
<xsl:variable name="appendix"
select="//*[contains(@class,' bookmap/appendix ')]" />
<xsl:choose>
<xsl:when test="count($level)=1 and parent::*/@id[. = //*/chapter/@id]">
<xsl:for-each select="$level">
<xsl:value-of
select="count(preceding-sibling::*[contains(@class,' topic/topic ')]) + 1"
/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:when>
<xsl:when test="count($level)=1 and parent::*/@id[. = //*/appendix/@id]">
<!-- from="*[contains(@class,' topic/topic ')][@id[. = $appendix[1]/@id]"-->
<!-- <xsl:number level="multiple" format="A"/>-->
<xsl:for-each select="$level">
<xsl:number
value="count(preceding-sibling::*[contains(@class,' topic/topic ')][@id =
//*/appendix/@id]) + 1"
format="A"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:when>
<xsl:when
test="not(count($level) > $topicTitle.numLevel) and ancestor::*/@id[. =
//*/appendix/@id]">
<xsl:number
count="*[contains(@class,' topic/topic ')][@id =
//*/appendix/@id|//*/topicref/@id]"
level="multiple" format="A.1" />
<xsl:text> </xsl:text>
</xsl:when>
<xsl:when test="not(count($level) > $topicTitle.numLevel)">
<xsl:number count="*[contains(@class,' topic/topic ')]"
level="multiple" format="1.1" />
<xsl:text> </xsl:text>
</xsl:when>
<xsl:otherwise />
<!-- no title numbering at nth level where n > $topicTitle.numLevel -->
</xsl:choose>
</xsl:template>
<xsl:template match="*" mode="getTitle">
<xsl:choose>
<!-- add keycol here once implemented-->
<xsl:when test="@spectitle">
<xsl:value-of select="@spectitle"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
does not add leading numbers in headings for PDF output.
I don't get errors, and the PDF gets built, but not showing leading numbers.
Any idea how I can get leading numbers in the pdf with the new org.dita.pdf2?
Thanks