Exclude topics from numbering by their title
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 16
- Joined: Thu Dec 10, 2020 11:00 am
Exclude topics from numbering by their title
I use:
*.ditamap
transformation scenario - "DITA Map PDF - based on XSL-FO",
For numbering topics, I use "generate numbers before the topic's title" plugin from raducoravu.
I use custom.xsl against css.
I need to exclude topics from numbering by their title.
For example - topics starting with title "Example".
I made the following edits to the file customization.xsl of "generate numbers before the topic's title" plugin:
<xsl:variable name="topicName" select="ancestor-or-self::*[contains(@class, ' topic/title ')]"/>
<!-- Normal topics -->
<xsl:when test="$depth lt (xs:integer($numbers-before-title-depth) + 1)">
<xsl:number count="*[contains(@class, ' map/topicref ') and not(starts-with($topicName, 'Example'))] [not(ancestor-or-self::*[contains(@class, ' bookmap/frontmatter ')])]" format="1.1" level="multiple"/>
</xsl:when>
In pdf on toc and on topic page the number for topics "Example ..." is not displayed, but they are taken into account when calculating numbers of the following topics.
I no need to taken into account topics "Example ..." when calculating numbers of the following topics
Need help, advice
.
Thanks in advance.
*.ditamap
transformation scenario - "DITA Map PDF - based on XSL-FO",
For numbering topics, I use "generate numbers before the topic's title" plugin from raducoravu.
I use custom.xsl against css.
I need to exclude topics from numbering by their title.
For example - topics starting with title "Example".
I made the following edits to the file customization.xsl of "generate numbers before the topic's title" plugin:
<xsl:variable name="topicName" select="ancestor-or-self::*[contains(@class, ' topic/title ')]"/>
<!-- Normal topics -->
<xsl:when test="$depth lt (xs:integer($numbers-before-title-depth) + 1)">
<xsl:number count="*[contains(@class, ' map/topicref ') and not(starts-with($topicName, 'Example'))] [not(ancestor-or-self::*[contains(@class, ' bookmap/frontmatter ')])]" format="1.1" level="multiple"/>
</xsl:when>
In pdf on toc and on topic page the number for topics "Example ..." is not displayed, but they are taken into account when calculating numbers of the following topics.
I no need to taken into account topics "Example ..." when calculating numbers of the following topics
Need help, advice

Thanks in advance.
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Exclude topics from numbering by their title
Hi,
So you started from this plugin I made available about 3 years ago, right?
https://github.com/oxygenxml/dita-ot-numbering
Honestly we kind of moved away from XSL-FO based PDF publishing in the meantime and focused on CSS based publishing so my knowledge of XSL-FO based publishing is getting rusty as we have a dedicated team for CSS based PDF publishing.
In my opinion that "$topicName" xsl:variable (which is actually the topic title), you cannot compute it outside of the xsl:number, because for example let's say the xsl:template matches a topic with title "Hello", you compute the $topicName for it and it's "Hello", then you have the xpath matching:
and it will match all topicrefs because the title of the topic is "Hello", although there may be previous topics with titles like "Example:".
So without defining the $topicName variable I would maybe write the xpath expression for xsl:number something like:
So I'm trying to look at the title for each of the topicrefs. That "topicmeta/navtitle" should give you the title for the current topicref.
Usually when creating such xpath matches, I set in the transformation scenario the "clean.temp=no" parameter, publish and then look in the transformation scenario's temporary files folder for a file named something like "mapFileName_MERGED.xml", it is the merged XML document over which the XSLT is applied and in that file each topicref has a navigation title derived from the original topic title, like:
so this is what I'm trying to achieve with the xpath expression, look at the title of each specific topicref, instead of looking at the title of the current matched topic.
Regards,
Radu
So you started from this plugin I made available about 3 years ago, right?
https://github.com/oxygenxml/dita-ot-numbering
Honestly we kind of moved away from XSL-FO based PDF publishing in the meantime and focused on CSS based publishing so my knowledge of XSL-FO based publishing is getting rusty as we have a dedicated team for CSS based PDF publishing.
In my opinion that "$topicName" xsl:variable (which is actually the topic title), you cannot compute it outside of the xsl:number, because for example let's say the xsl:template matches a topic with title "Hello", you compute the $topicName for it and it's "Hello", then you have the xpath matching:
Code: Select all
*[contains(@class, ' map/topicref ') and not(starts-with($topicName, 'Example'))]
So without defining the $topicName variable I would maybe write the xpath expression for xsl:number something like:
Code: Select all
<xsl:number count="*[contains(@class, ' map/topicref ') and not(starts-with(topicmeta/navtitle/text(), 'Example'))] [not(ancestor-or-self::*[contains(@class, ' bookmap/frontmatter ')])]" format="1.1" level="multiple"/>
Usually when creating such xpath matches, I set in the transformation scenario the "clean.temp=no" parameter, publish and then look in the transformation scenario's temporary files folder for a file named something like "mapFileName_MERGED.xml", it is the merged XML document over which the XSLT is applied and in that file each topicref has a navigation title derived from the original topic title, like:
Code: Select all
<topicref class="- map/topicref " xtrc="topicref:1;5:45"
xtrf="..../flowers.ditamap"
href="#unique_1" id="unique_1" type="topic" ohref="topics/introduction.dita"
first_topic_id="#unique_1">
<topicmeta class="- map/topicmeta " data-topic-id="introduction">
<resourceid class="- topic/resourceid " oxy-source="topic" appid="introduction"/>
<navtitle class="- topic/navtitle ">Introduction</navtitle>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service