Page 1 of 1

Title for prereq, context, postreq elements

Posted: Tue May 30, 2023 5:56 pm
by ann.jensen
Hi,
When using General Task topic type, I would like to have a title associated with each of the elements before and after the <steps>. Is there any way to add a title to these elements OOTB that will then be transformed into a heading in generated HTML?
Thanks in advance,
Ann

Re: Title for prereq, context, postreq elements

Posted: Wed May 31, 2023 12:46 am
by chrispitude
Hi Ann,

DIfferent transformation types are customized in different ways. What transformation types are you using?

Re: Title for prereq, context, postreq elements

Posted: Wed May 31, 2023 7:44 am
by Radu
Hi Ann,
The DITA task model is quite restrictive, you cannot add sections in it.
Maybe you can try some workaround like:

Code: Select all

<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA General Task//EN" "generalTask.dtd">
<task id="task_b2p_drj_qxb">
    <title></title>
    <shortdesc></shortdesc>
    <taskbody>
        <prereq>
            <sectiondiv>
                <b>Some title before</b>
                <p>Some para</p>
            </sectiondiv>
        </prereq>
        <steps>
            <step>
                <cmd>some step</cmd>
            </step>
            <step>
                <cmd>some step</cmd>
            </step>
        </steps>
        <postreq>
            <sectiondiv>
                <b>Some title after</b>
                <p>Some para</p>
            </sectiondiv>
        </postreq>
    </taskbody>
</task>
Regards,
Radu

Re: Title for prereq, context, postreq elements

Posted: Wed May 31, 2023 12:18 pm
by ann.jensen
>>Different transformation types are customized in different ways. What transformation types are you using?
I am using the Oxygen WebHelp tranform. The request is related to web accessibility where my customers want to have headings for each area of the task procedure so that they can be interpreted by automated screen readers....which seems reasonable to me.
I thought it might be possible since prereq, context and postreq are specializations of section but it seems <title> is not a valid child element of these elements.
Regards,
Ann

Re: Title for prereq, context, postreq elements

Posted: Thu Jun 01, 2023 2:28 pm
by chrispitude
Hi Ann,

I made a DITA-OT plugin for HTML5-based deliverables (html5, webhelp-responsive, pdf-css-html5). It is provided in the following testcase:

webhelp_task_headings.zip

In the plugin, there is an XSLT3 map of heading strings that you can customize:

Code: Select all

  <!-- define heading values to use for task elements -->
  <xsl:variable name="task-headings" as="map(xs:string, xs:string)" select="map {
    'prereq': 'Prerequisites',
    'context': 'Context',
    'steps': 'Steps',
    'result': 'Results',
    'example': 'Example',
    'postreq': 'What Next'
  }"/>
The default output looks like this:

image.png

Because <example> elements are allowed to have <title> elements in a task, an example heading is added only if there is no writer-defined title.

In the WebHelp output, note that the "Context", "Steps", and "Example" headings are not picked up by the WebHelp post-processing for sections (expand/collapse, and the right-side TOC). I am not sure how important this is to you.

Re: Title for prereq, context, postreq elements

Posted: Mon Jul 08, 2024 5:35 pm
by LASSE_MLE
Hi Chrispitude,
This topic is quite old but I do have a question about it.
I've implemented your solution and this is nice, but is it really not possible to have the "sections" of the task in the Topic TOC on the right side of the page (like for sections in a concept topic) ?
Thank you for your help!