Modifying header title size for topics in HTML output
Oxygen general issues.
-
- Posts: 58
- Joined: Fri Sep 12, 2008 12:12 am
Modifying header title size for topics in HTML output
At my worksplace we are using an alternate version of dita2html.xsl that puts all the content on a single page - instead of generating a main page with the TOC which you then click on various links to get to the individual topics on their own page - so now the default sizing of the topic header titles has become a problem in that they are all the same size (huge to say the least), and do not refelect the hierarchy in the ditamap. I was trying to investigate a way to alter this by looking for any relevant section in dita2htmlImpl.xsl and found a section from lines 277-294 that mention the heading size, but I'm not sure if this can be modified for our purposes.
In its comments section it says:
and also has a modifiable section here (lines 283-286):
But I am unsure what the 6 refers to. Is it checking the nesting depth? Aside from that though, am I even barking up the right tree? Is there any way you can think of to specify to DITA that topic headings should be sized differently based on their hierarchical position in the ditamap?
Thanks for your input.
~Josh
In its comments section it says:
Code: Select all
<!-- NESTED TOPIC TITLES (sensitive to nesting depth, but are still processed for contained markup) -->
<!-- 1st level - topic/title -->
<!-- Condensed topic title into single template without priorities; use $headinglevel to set heading.
If desired, somebody could pass in the value to manually set the heading level -->
Code: Select all
<xsl:choose>
<xsl:when test="count(ancestor::*[contains(@class,' topic/topic ')]) > 6">6</xsl:when>
<xsl:otherwise><xsl:value-of select="count(ancestor::*[contains(@class,' topic/topic ')])"/></xsl:otherwise>
</xsl:choose>
Thanks for your input.
~Josh
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Modifying header title size for topics in HTML output
Hi Josh,
You are indeed near the XSLT code which does that.
There should be a code fragment which specifies:
The {$headinglevel} variable actually specifies the index of the heading to set in the output (h1, h2....etc) depending on the nesting of the current topic in the whole document.
For example, if you replace {$headinglevel} with a hardcoded 3 you will always have <h3> used for topic titles regardless of the imbrication.
It's probably better to make a fix in the place where the headinglevel is computed and increase it by 1 for example. In this way, your topic titles will begin with <h2> and increase depending on the imbrication.
This fix should look like:
Regards,
Radu
You are indeed near the XSLT code which does that.
There should be a code fragment which specifies:
Code: Select all
<xsl:element name="h{$headinglevel}">
<xsl:attribute name="class">topictitle<xsl:value-of select="$headinglevel"/></xsl:attribute>
<xsl:call-template name="commonattributes"/>
<xsl:apply-templates/>
</xsl:element>
For example, if you replace {$headinglevel} with a hardcoded 3 you will always have <h3> used for topic titles regardless of the imbrication.
It's probably better to make a fix in the place where the headinglevel is computed and increase it by 1 for example. In this way, your topic titles will begin with <h2> and increase depending on the imbrication.
This fix should look like:
Code: Select all
<xsl:param name="headinglevel">
<xsl:choose>
<xsl:when test="count(ancestor::*[contains(@class,' topic/topic ')]) > 6">6</xsl:when>
<xsl:otherwise><xsl:value-of select="count(ancestor::*[contains(@class,' topic/topic ')]) + 1"/></xsl:otherwise>
</xsl:choose>
</xsl:param>
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 58
- Joined: Fri Sep 12, 2008 12:12 am
Re: Modifying header title size for topics in HTML output
Thank you, that did decrease the header size a bit, although I still need to get something straight. From looking at the code it looks like the idea is to discover a topic's depth in the hierarchy tree by using ancestor::* and if you are at the root level it returns 1 (H1 being the largest font size), a child of the root gets H2, a child of that gets H3, etc. So in theory the size decreases for each child based on its tree depth, correct? If so then it is not functioning that way. I have children topics on the third "rung" of the tree that have headers that are just as large as the header text for its parent and the root topic above that. Is there a reason this is not working? Have I misunderstood how the header size code is supposed to work?
Thanks,
Josh
Thanks,
Josh
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Modifying header title size for topics in HTML output
Hi Josh,
Indeed this is the way in which that XSLT code should work.
If in the HTML file you select a topic title which should be smaller and then right click and "Show Source" (the action is available in Firefox) what is the header used to render that topic title?
You can also add some xsl:messages in the XSLT code and find out more about the way the header is computed.
Regards,
Radu
Indeed this is the way in which that XSLT code should work.
If in the HTML file you select a topic title which should be smaller and then right click and "Show Source" (the action is available in Firefox) what is the header used to render that topic title?
You can also add some xsl:messages in the XSLT code and find out more about the way the header is computed.
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