Page 1 of 1
How to change default behavior of webhelp output that tests
Posted: Thu Dec 18, 2014 11:52 pm
by mstrubberg
When entering any type of list <ol>, <ul>, <dl>, <sl>, <choices> the compact attribute value is not set in the XML.
However, webhelp output is defaulting all lists to compact="yes", thereby compressing the list items together.
I don't want to require that all lists must have compact="no" applied.
What is the best way to default all lists to compact="no"?
Re: How to change default behavior of webhelp output that te
Posted: Fri Dec 19, 2014 12:19 pm
by sorin_ristache
The default value of the
compact attribute in DITA XML topics is
yes for
ordered lists,
unordered lists, etc. So if you want to have a larger space between list items the usual way is to add the
compact="no" attribute on the XML list elements.
Other option that would follow the DITA spirit is to extend the DITA schema and create a
DITA specialization that sets the
compact attribute to the value that you want on the XML elements that you want.
A more expedient option is to do the following changes in the file
OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\plugins\org.dita.xhtml\xsl\xslhtml\dita2htmlImpl.xsl:
- 1. Replace the code:
Code: Select all
<xsl:template match="*[contains(@class, ' topic/li ')]" name="topic.li">
<li>
<xsl:choose>
<xsl:when test="parent::*/@compact = 'no'">
<xsl:attribute name="class">liexpand</xsl:attribute>
<!-- handle non-compact list items -->
<xsl:call-template name="commonattributes">
<xsl:with-param name="default-output-class" select="'liexpand'"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="commonattributes"/>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="setidaname"/>
<xsl:apply-templates/>
</li><xsl:value-of select="$newline"/>
</xsl:template>
with the code:
Code: Select all
<xsl:template match="*[contains(@class, ' topic/li ')]" name="topic.li">
<li>
<xsl:attribute name="class">liexpand</xsl:attribute>
<!-- handle non-compact list items -->
<xsl:call-template name="commonattributes">
<xsl:with-param name="default-output-class" select="'liexpand'"/>
</xsl:call-template>
<xsl:call-template name="setidaname"/>
<xsl:apply-templates/>
</li><xsl:value-of select="$newline"/>
</xsl:template>
2. Replace the code:
Code: Select all
<xsl:template match="*[contains(@class, ' topic/sli ')]" name="topic.sli">
<li>
<xsl:choose>
<xsl:when test="parent::*/@compact = 'no'">
<xsl:attribute name="class">sliexpand</xsl:attribute>
<!-- handle non-compact list items -->
<xsl:call-template name="commonattributes">
<xsl:with-param name="default-output-class" select="'sliexpand'"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="commonattributes"/>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="commonattributes"/>
<xsl:call-template name="setidaname"/>
<xsl:apply-templates/>
</li><xsl:value-of select="$newline"/>
</xsl:template>
with the code:
Code: Select all
<xsl:template match="*[contains(@class, ' topic/sli ')]" name="topic.sli">
<li>
<xsl:attribute name="class">sliexpand</xsl:attribute>
<!-- handle non-compact list items -->
<xsl:call-template name="commonattributes">
<xsl:with-param name="default-output-class" select="'sliexpand'"/>
</xsl:call-template>
<xsl:call-template name="commonattributes"/>
<xsl:call-template name="setidaname"/>
<xsl:apply-templates/>
</li><xsl:value-of select="$newline"/>
</xsl:template>
Re: How to change default behavior of webhelp output that te
Posted: Fri Dec 19, 2014 4:57 pm
by mstrubberg
Thanks Sorin, Removing the test for compact='no' worked perfectly.