Page 1 of 1

Detecting WebHelp transformation in DITA-OT plugin

Posted: Sat Jun 18, 2016 1:16 pm
by HomeGoods
Hi,
I have a DITA-OT plugin that is installed via this extension point:

Code: Select all

<feature
extension="dita.xsl.xhtml"
file="my-custom.xsl" />
In that "my-custom.xsl", I want to know if it is currently running for WebHelp transformation or not. What do you think is the most reliable way?
If possible, I like to detect its type (Classic or Responsive).

Re: Detecting WebHelp transformation in DITA-OT plugin

Posted: Tue Jun 21, 2016 3:27 pm
by radu_pisoi
Hi,

Yes, it is possible by creating the 'TRANSTYPE' XSLT parameter in your custom stylesheet. It's value will be assigned either to 'webhelp-responsive' for Webhelp Responsive transformation or to 'webhelp' for Webhelp Classic transformation.

Code: Select all


<xsl:param name="TRANSTYPE"></xsl:param>
<xsl:template ...>
<xsl:choose>
<xsl:when test="$TRANSTYPE = 'webhelp-responsive'">
Webhelp Responsive transformation
</xsl:when>
<xsl:when test="$TRANSTYPE = 'webhelp'">
Webhelp Classic transformation
</xsl:when>
<xsl:otherwise>
Other type of XHTML transformation
</xsl:otherwise>
</xsl:choose>

Re: Detecting WebHelp transformation in DITA-OT plugin

Posted: Tue Jun 21, 2016 6:19 pm
by HomeGoods
Thank you, Radu. Worked quite nicely.