Generate the map title with additional metadata

Post here questions and problems related to editing and publishing DITA content.
gbv34
Posts: 105
Joined: Thu Jan 20, 2022 12:36 pm

Generate the map title with additional metadata

Post by gbv34 »

Hello, everyone!
I have a bookmap that includes plenty of information in its metadata.
For instance, I have prodname or vrm version.
In my situation, I would like to adapt the HTML5 output to concatenate the mainbooktitle with the prodname.
I analyzed the map2html5-coverImpl.xsl in the plugin org.dita.html5 and I didn't see where I could apply this change.
The only place where I can find the class mainbooktitle is in the template generateChapterTitle and it seems to apply at the chapter level, or I could find it in the parent template but I think it generates the main title for the topics.

Code: Select all

  <xsl:template match="*[contains(@class,' bookmap/bookmap ')]/*[contains(@class,' bookmap/booktitle ')]" priority="10">
    <h1 class="title topictitle1">
      <xsl:call-template name="gen-user-panel-title-pfx"/>
      <xsl:apply-templates select="*[contains(@class, ' bookmap/mainbooktitle ')]/node()"/>
    </h1>
  </xsl:template>
So, where would you advise me to look to change the title of the main map?
------
Gaspard
gbv34
Posts: 105
Joined: Thu Jan 20, 2022 12:36 pm

Re: Generate the map title with additional metadata

Post by gbv34 »

I eventually found that I could use the template

Code: Select all

gen-user-panel-title-pfx
and succeeded in applying the modification in topic.xsl and map2htmltocImpl.xsl :)

Code: Select all

<xsl:template name="gen-user-panel-title-pfx">
  <xsl:apply-templates select="." mode="gen-user-panel-title-pfx"/>
</xsl:template>
<xsl:template match="/|node()|@*" mode="gen-user-panel-title-pfx">
<xsl:value-of select="/*[contains(@class,' bookmap/bookmap ')]/*[contains(@class,' bookmap/booktitle ')]/*[contains(@class, ' bookmap/booklibrary ')]"/>
<xsl:if test="/bookmap/bookmeta/prodinfo/vrmlist/vrm/@version">
<b> - </b>
<xsl:text> v</xsl:text>
<xsl:value-of select="/bookmap/bookmeta/prodinfo/vrmlist/vrm/@version"/>
<xsl:text>. </xsl:text>
</xsl:if>
</xsl:template>
------
Gaspard
Post Reply