Page 1 of 1

How to delete the colon after Optional tag

Posted: Thu Sep 19, 2019 10:57 am
by lhsihan
We don't want to have colon after "Optional" tag, how can we get this done?

The xml is as below:

Code: Select all

   <step importance="optional" >
                <cmd>test</cmd>
                <info>test</info>
            </step>
When transforming the doc to HTML5 format, we can see "Optional: " in HTML file. How can we make this as "Optional" without the colon?

Thanks a lot.

Re: How to delete the colon after Optional tag

Posted: Wed Oct 02, 2019 12:09 pm
by ionela
Hi,

Unfortunately, there is no easy out of the box way to remove the colon after the "Optional" tag. You can achieve this by developing a customization using XSLT extension points (this requires XSLT knowledge):
How to Use XSLT Extension Points from a Publishing Template
You can try to add and XSLT extension point on com.oxygenxml.webhelp.xsl.dita2webhelp:
XSLT-Import Extension Points

As a hint. using XSLT extension points you should override the standard functionality that inserts the colon from [DITA_OT_DIR]\plugins\org.dita.html5\xsl\task.xsl:

Code: Select all

  <xsl:template match="*" mode="add-step-importance-flag">
    <xsl:choose>
      <xsl:when test="@importance='optional'">
        <strong>
          <xsl:call-template name="getVariable">
            <xsl:with-param name="id" select="'Optional'"/>
          </xsl:call-template>
          <xsl:call-template name="getVariable">
            <xsl:with-param name="id" select="'ColonSymbol'"/>
          </xsl:call-template><xsl:text> </xsl:text>
        </strong>
      </xsl:when>
      <xsl:when test="@importance='required'">
        <strong>
          <xsl:call-template name="getVariable">
            <xsl:with-param name="id" select="'Required'"/>
          </xsl:call-template>
          <xsl:call-template name="getVariable">
            <xsl:with-param name="id" select="'ColonSymbol'"/>
          </xsl:call-template><xsl:text> </xsl:text>
        </strong>
      </xsl:when>
    </xsl:choose>
  </xsl:template>
I hope this helps.

Regards,
Ionela