Detecting WebHelp transformation in DITA-OT plugin

HomeGoods
Posts: 87
Joined: Wed Feb 09, 2005 8:57 am

Detecting WebHelp transformation in DITA-OT plugin

Post by HomeGoods » Sat Jun 18, 2016 1:16 pm

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).

radu_pisoi
Posts: 343
Joined: Thu Aug 21, 2003 11:36 am
Location: Craiova
Contact:

Re: Detecting WebHelp transformation in DITA-OT plugin

Post by radu_pisoi » Tue Jun 21, 2016 3:27 pm

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>
Radu Pisoi
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

HomeGoods
Posts: 87
Joined: Wed Feb 09, 2005 8:57 am

Re: Detecting WebHelp transformation in DITA-OT plugin

Post by HomeGoods » Tue Jun 21, 2016 6:19 pm

Thank you, Radu. Worked quite nicely.

Post Reply