Limiting levels of chapter numbering in ditamaps

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Boreas
Posts: 86
Joined: Wed Feb 09, 2011 10:43 pm

Limiting levels of chapter numbering in ditamaps

Post by Boreas »

Hello,

I work with ditamaps and I am able to number all the levels of my ditamap in my pdf output. I would like to limit the numbering to the 2 first levels of the ditamap.

In the customs.xsl file ( under xsl) I added

Code: Select all


<xsl:number count="*[contains(@class, ' map/topicref ')] [not(ancestor-or-self::*[contains(@class, ' bookmap/frontmatter ')])]" format="1.1" level="multiple" />

And it numbered all the levels.

the I replaced the previous code by
[code]
<xsl:number format="1" count="topicref|topicref" level="multiple" />
[/code]
And I got the exact same result: all levels are numbered.

I tried adding

Code: Select all

<xsl:for-each select="topicref [position()< 2]"/>
but with no success.

Is there something equivalent to the

Code: Select all

<xsl:variable name="tocMaximumLevel">4</xsl:variable>
for chapter numbering? Is there a way to limit the levels included in the numbering?

Regards
Carole
Radu
Posts: 9449
Joined: Fri Jul 09, 2004 5:18 pm

Re: Limiting levels of chapter numbering in ditamaps

Post by Radu »

Hi Carole,

I do not have enough information about what template you overwrote in your custom.xsl.
If you have a DITA PDF customization folder which I could test please send it to support@oxygenxml.com and I will try to take some time to look into this.
You could also post about this issue on the DITA Users List, maybe they have some suggestions for you.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Boreas
Posts: 86
Joined: Wed Feb 09, 2011 10:43 pm

Re: Limiting levels of chapter numbering in ditamaps

Post by Boreas »

Hello,
I guess I needed to post the question to be able to get the 'Radu' inspiration. :wink:
well in one of the users group I found part of a solution.
This is my solution. In the customs.xsl file, add:

Code: Select all

<xsl:template match="*" mode="getTitle">
<xsl:variable name="topic" select="ancestor-or-self::*[contains(@class, ' topic/topic ')[1]" />
<xsl:variable name="id" select="$topic/@id" />
<xsl:variable name="mapTopics" select="key('map-id', $id)" />
<xsl:variable name="level" select="count(ancestor::*[contains(@class,' topic/topic ')])"/>
<fo:inline>
<xsl:choose>
<xsl:when test="//othermeta[@name='ChapterNumbering'][@content='yes']">
<xsl:for-each select="$mapTopics[1]">
<xsl:choose>
<xsl:when test="$level = 1 or $level = 2">
<xsl:number count="*[contains(@class, ' map/topicref ')] [not(ancestor or-self::*[contains(@class, ' bookmap/frontmatter ')])]" format="1.1" level="multiple"/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</fo:inline>
<xsl:text> </xsl:text>
<xsl:apply-templates />
</xsl:template>

And the result is that only the first two levels of the dita map are numbered.
If you use the following values instead, only levels 2 and 3 are numbered
<xsl:when test="$level = 2 or $level = 3">

But I did not find how to limit to 3 levels :( but for now,this solves my problem.

Regards
Carole
Post Reply