Page 1 of 1

Applying conditions/profiling to ANT script for Webhelp

Posted: Tue Jul 09, 2013 6:23 pm
by Marie
Hello,

I am currently using version 14.2 (with version 15 just waiting for me to perform the upgrade) of Oxygen XML Editor. The built-in Docbook Webhelp transformation scenario and the duplicate I am customizing do not apply the conditioning/profiling used in my documents. Should I add something to the build.xml or build_docbook.xml files?

Thanks,
Marie

Re: Applying conditions/profiling to ANT script for Webhelp

Posted: Wed Jul 10, 2013 3:07 pm
by sorin_ristache
Hi Marie,

The profiling parameters are applied by the Docbook Webhelp transformation just like the other Docbook transformations available in Oxygen: Docbook XHTML, Docbook PDF, etc. What values did you set for which profiling parameters in the dialog box for editing the Docbook Webhelp transformation? Does the Webhelp output include all profiles, as if the profiling attributes did not exist? Can you post here (or send us directly) a sample Docbook XML document that includes profiles marked by profiling attributes and that shows the problem?


Regards,
Sorin

Re: Applying conditions/profiling to ANT script for Webhelp

Posted: Wed Jul 10, 2013 5:19 pm
by Marie
Hi Sorin,

Your questions provided at least one solution, but maybe not the one I am looking for. Setting the condition parameter in the transformation resolves the problem of the condition not being applied and I assume that will also work for the conformance option we use.

But for our (customized) PDF transformation, we do not have to edit the transformation each time we want to generate the output for a different condition. In fact, in both the default and custom PDF transformation, it is not possible to change the condition within the transformation. The transformation reads the condition declared in the document. For example, in this case, the "scm" condition would be applied:

<chapter version="5.0" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:svg="http://www.w3.org/2000/svg" xmlns:m="http://www.w3.org/1998/Math/MathML"
xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"
xml:id="RunInstaller" condition="scm">

Is there a way to automate the application of declared condition and conformance in the Webhelp transformation so that one transformation will work for all condition and conformance settings and we do not have to edit the transformation every time we generate Webhelp?

Marie

Re: Applying conditions/profiling to ANT script for Webhelp

Posted: Thu Jul 11, 2013 12:47 pm
by sorin_ristache
Hi Marie,
Marie wrote:Setting the condition parameter in the transformation resolves the problem of the condition not being applied and I assume that will also work for the conformance option we use.
This is the way a profile is selected in a Docbook transformation (any Docbook transformation: PDF, Webhelp, XHTML, etc): the value of the profiling attribute (in your case the condition and conformance attributes) that defines the profile is set by a parameter of the transformation (in your case profile.condition and profile.conformance).
Marie wrote:But for our (customized) PDF transformation, we do not have to edit the transformation each time we want to generate the output for a different condition. In fact, in both the default and custom PDF transformation, it is not possible to change the condition within the transformation.
You have to set the profiling parameter to the value of the profiling attribute corresponding to your profile. When you want to generate the output for the "scm" profile you have to set the value of the parameter profile.condition to the value scm. When you want to generate the output for other profile, for example "scm2", you have to set the value of the parameter profile.condition to the value scm2.
Marie wrote:Is there a way to automate the application of declared condition and conformance in the Webhelp transformation so that one transformation will work for all condition and conformance settings and we do not have to edit the transformation every time we generate Webhelp?
Maybe you want to generate the outputs for all profiles with only one action in the Oxygen application, without editing the transformation and repeating the transformation with the modified parameters for each profile? That is possible and I suggest you do the following:
  • set the values of all your parameters in the dialog box for editing a Docbook Webhelp transformation, including the profiling attributes (in your case profile.condition and profile.conformance);
  • duplicate this transformation using the Duplicate button in the dialog box that lists all transformations; you should duplicate the transformation for each combination of values of the profiling attributes;
  • select all these duplicated transformations in the list by selecting the checkbox next to each one; the effect is that the set of all selected transformations will be associated with the current XML document (a Docbook XML document in your case), and executed all at the same time whenever needed;
  • run all these transformations with just one press of the Apply Associated button (in the dialog box with all transformations) or with one press of the toolbar button called Apply Transformation Scenario(s) or (in case your XML document is in the Project view) with a right-click in the XML document in the Project view and selecting the action Transform -> Apply Transformation Scenarios(s) in the popup menu.
We also have a video demonstration about profiles and profiling conditions in Docbook documents on the video demonstrations page.


Regards,
Sorin

Re: Applying conditions/profiling to ANT script for Webhelp

Posted: Thu Jul 11, 2013 1:42 pm
by Marie
Hi Sorin,

I think I'll email you at the support address you provided in your first response as we are not really going in the same direction with this conversation. I know how profiling works and have been using it without any problems for the past four years for our PDF generation. And I do not have 15 separate PDF transformation scenarios for each of our conditions. I use a custom engine and one (and only one) PDF transformation scenario, which correctly manages all of our conditions and we never edit its parameters. I'm looking for the way to create an equivalent process/setup for the Webhelp ant script, as 15 different transformations scenarios for Webhelp is really not an ideal solution.

Marie

Re: Applying conditions/profiling to ANT script for Webhelp

Posted: Thu Jul 11, 2013 1:47 pm
by Marie
And thanks for trying to help - I am probably not explaining correctly enough for you to provide me with the right information.

Marie

Re: Applying conditions/profiling to ANT script for Webhelp

Posted: Thu Jul 11, 2013 2:11 pm
by sorin_ristache
Hi Marie,
Marie wrote:I think I'll email you at the support address you provided in your first response as we are not really going in the same direction with this conversation. I know how profiling works and have been using it without any problems for the past four years for our PDF generation.
If you just post here a complete example of your workflow (a small sample XML document, the needed output profiles, the actions executed to generate the needed outputs, etc) with a little more details than above that would probably clarify your request. Anyway I will wait for your details, either on this forum topic or by email.


Regards,
Sorin

Re: Applying conditions/profiling to ANT script for Webhelp

Posted: Tue Jul 16, 2013 7:31 pm
by Marie
For anyone else who might be interested in having the profiling/conditions read from the declarations in their documents instead of having to edit the transformation UI, adding these lines to the chunk_custom.xsl file in the {InstallDirectory}\frameworks\docbook\xsl\com.oxygenxml.webhelp\xsl directory solves the problem:

<xsl:variable name="profile.vendor">
<xsl:if test="//@vendor">
<xsl:value-of select="//@vendor"/>
</xsl:if>
</xsl:variable>

<xsl:variable name="profile.condition">
<xsl:if test="//@condition">
<xsl:value-of select="//@condition"/>
</xsl:if>
</xsl:variable>

<xsl:variable name="profile.conformance">
<xsl:if test="//@conformance">
<xsl:value-of select="//@conformance"/>
</xsl:if>
</xsl:variable>

Follow-up question for someone with deeper knowledge of the Oxygen file system and Webhelp setup: To cleanly separate the Oxygen files from my own customization, I would prefer to extract these lines from the chunk_custom.xsl file and put them in a separate .xsl file; for example, custom.xsl. How would I get this file to be read by the transformation?

Re: Applying conditions/profiling to ANT script for Webhelp

Posted: Wed Jul 17, 2013 10:39 am
by sorin_ristache
Hello,

You can create a file called custom.xsl with the content:

Code: Select all

<xsl:variable name="profile.vendor">
<xsl:if test="//@vendor">
<xsl:value-of select="//@vendor"/>
</xsl:if>
</xsl:variable>

<xsl:variable name="profile.condition">
<xsl:if test="//@condition">
<xsl:value-of select="//@condition"/>
</xsl:if>
</xsl:variable>

<xsl:variable name="profile.conformance">
<xsl:if test="//@conformance">
<xsl:value-of select="//@conformance"/>
</xsl:if>
</xsl:variable>
You need to include this file in the chunk_custom.xsl stylesheet because the variables are needed when this stylesheet is applied to the Docbook XML document.

The directory where you place the custom.xsl stylesheet is not important, just make sure you set the correct path in the xsl:include element. For example if you place the custom.xsl file in the parent directory of the chunk_custom.xsl file (that is [Oxygen-install-dir]\frameworks\docbook\xsl\com.oxygenxml.webhelp\xsl) then the xsl:include element would look like the following in the chunk_custom.xsl file:

Code: Select all

<xsl:include href="../custom.xsl"/>

Regards,
Sorin