Using args.xsl with WebHelp plugin

Here should go questions about transforming XML with XSLT and FOP.
smckenzie23
Posts: 7

Using args.xsl with WebHelp plugin

Sat Nov 01, 2014 1:37 am

Hello.

I am trying to modify the WebHelp plugin to produce slightly different builds for multiple products.

What I would like to do is use the args.xsl parameter when I create a Transformation Scenario so that I can have a WebHelp build that uses a modified createMainFile.xsl. In particular, I'd like to be able to add a couple extra buttons in the create-toc-common-file template.

To test, I've created a separate version of that file, and referenced it in args.xsl like this:

"Oxygen XML Editor 15\frameworks\dita\DITA-OT\plugins\com.oxygenxml.webhelp\xsl\dita\dita2webhelp2.xsl"

For now, I simply modified a section to drop in some text for testing. Things appear to be building fine, and it does create an index.htm with my example text included. However, it seems to be placing it in the concepts directory of my output rather than the root level.

So, I'm a bit confused about how to use args.xsl with the WebHelp plugin. What is the top-level xsl file I should be passing in?

Thanks.
sorin_ristache
Posts: 4144

Re: Using args.xsl with WebHelp plugin

Mon Nov 03, 2014 6:58 pm

Hello,

smckenzie23 wrote:In particular, I'd like to be able to add a couple extra buttons in the create-toc-common-file template.

To test, I've created a separate version of that file, and referenced it in args.xsl like this:

"Oxygen XML Editor 15\frameworks\dita\DITA-OT\plugins\com.oxygenxml.webhelp\xsl\dita\dita2webhelp2.xsl"


You should not use the args.xsl parameter for setting or adding an XSLT stylesheet in the WebHelp transformation. You should use one of the existing XSLT stylesheets in directory OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\plugins\com.oxygenxml.webhelp\xsl.

smckenzie23 wrote:Things appear to be building fine, and it does create an index.htm with my example text included. However, it seems to be placing it in the concepts directory of my output rather than the root level.


The index.html file is always created in the output directory of the WebHelp transformation. Maybe you have a topic called index.dita or index.xml in the concepts sub-directory of the directory of your input DITA map file?

smckenzie23 wrote:So, I'm a bit confused about how to use args.xsl with the WebHelp plugin. What is the top-level xsl file I should be passing in?


In what area of the WebHelp page do you want to add the buttons? Usually the file to be modified for adding such customizations is:

Code: Select all

OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\plugins\com.oxygenxml.webhelp\xsl\createMainFiles.xsl
Regards,
Sorin

<oXygen/> XML Editor Support
smckenzie23
Posts: 7

Re: Using args.xsl with WebHelp plugin

Mon Nov 03, 2014 9:20 pm

You should not use the args.xsl parameter for setting or adding an XSLT stylesheet in the WebHelp transformation. You should use one of the existing XSLT stylesheets in directory .


But I don't want to modify all builds. I want to selectively add buttons for a particular build that is going in one of our product's online help. These buttons (which will link to dynamic, active pages in the product) will not exist in other builds or when published to the web. If I modify the existing XSLT it will require a ton of xsl:if conditions that that will be difficult to maintain for all of our concurrent product builds. If I could override the XSLT selectively (which is what args.xsl is for) things would be much easier.
smckenzie23
Posts: 7

Re: Using args.xsl with WebHelp plugin

Mon Nov 03, 2014 9:49 pm

The index.html file is always created in the output directory of the WebHelp transformation. Maybe you have a topic called index.dita or index.xml in the concepts sub-directory of the directory of your input DITA map file?


So, no. The index.html that is showing up in my concepts directory is the one produced by my modified version of createMinFiles.xsl that I passed in with args.xsl.
sorin_ristache
Posts: 4144

Re: Using args.xsl with WebHelp plugin

Tue Nov 04, 2014 1:40 pm

smckenzie23 wrote:
The index.html file is always created in the output directory of the WebHelp transformation. Maybe you have a topic called index.dita or index.xml in the concepts sub-directory of the directory of your input DITA map file?


So, no. The index.html that is showing up in my concepts directory is the one produced by my modified version of createMinFiles.xsl that I passed in with args.xsl.


Please do not modify the WebHelp transformation by setting the args.xsl parameter. Please modify the transformation in one of the XSLT stylesheets of the WebHelp transformation as I said above.
Regards,
Sorin

<oXygen/> XML Editor Support
sorin_ristache
Posts: 4144

Re: Using args.xsl with WebHelp plugin

Tue Nov 04, 2014 2:32 pm

smckenzie23 wrote:
You should not use the args.xsl parameter for setting or adding an XSLT stylesheet in the WebHelp transformation. You should use one of the existing XSLT stylesheets in directory .


But I don't want to modify all builds. I want to selectively add buttons for a particular build that is going in one of our product's online help. These buttons (which will link to dynamic, active pages in the product) will not exist in other builds or when published to the web. If I modify the existing XSLT it will require a ton of xsl:if conditions that that will be difficult to maintain for all of our concurrent product builds. If I could override the XSLT selectively (which is what args.xsl is for) things would be much easier.


There are many XSLT transformations in the WebHelp transformation. The args.xsl parameter will replace only one of them.

How do you plan to add buttons selectively with the args.xsl parameter? If I understand better what you try to do I may give you a solution for the WebHelp transformation.
Regards,
Sorin

<oXygen/> XML Editor Support
smckenzie23
Posts: 7

Re: Using args.xsl with WebHelp plugin

Tue Nov 04, 2014 8:55 pm

In createMainFiles.xsl I would like to override the create-toc-common-file topic. It would be easiest for maintenance if I could simply copy the xsl file, modify that, and then build using args.xsl to specify the modified xsl that would be the easiest to maintian. We have many different products across several sites. Even for this one product I need a build with the added button and one without. While it would be possible to modify this one xsl file with conditional processing, I'd need to pass in a parameter or have some way of know which build to produce. Plus it would rapidly become difficult to maintain. Another option is that I could copy the entire plugin, modify the xsl, and then register the new plugin as its own transtype.

Both of these options seem unnecessarily complex considering the toolkit has args.xsl built in as the right way to override processing.

Plus, args.xsl seems to be working and producing my modified output, just in the wrong directory. So I have a feeling it will work, but that I'm doing something dumb.

So, in short, I need to have a modified create-toc-common-file template from createMainFiles.xsl for some builds, but not others.

I'm wondering if creating a separate transtype is the right approach.
smckenzie23
Posts: 7

Re: Using args.xsl with WebHelp plugin

Tue Nov 04, 2014 10:12 pm

So it looks like you are selectively choosing a different createMainFiles.xsl in build_dita.xml. Could I simply specify a different createMainFiles.xsl by setting args.create.main.files.xsl?

Code: Select all

  <!-- Create the index.htm and toc.htm files. -->
  <target name="create-main-files">

    <if>
      <isset property="webhelp.mobile"/>
      <then>
        <property name="args.create.main.files.xsl"
          value="${dita.dir}/plugins/com.oxygenxml.webhelp/xsl/dita/mobile/createMainFiles.xsl"/>
      </then>
      <else>
        <property name="args.create.main.files.xsl"
          value="${dita.dir}/plugins/com.oxygenxml.webhelp/xsl/createMainFiles.xsl"/>
      </else>
    </if>
sorin_ristache
Posts: 4144

Re: Using args.xsl with WebHelp plugin

Wed Nov 05, 2014 10:28 am

Yes, I think you should specify a different createMainFiles.xsl by setting args.create.main.files.xsl instead of creating a new transtype in DITA-OT.
Regards,
Sorin

<oXygen/> XML Editor Support

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 2 guests