Title for prereq, context, postreq elements

Post here questions and problems related to editing and publishing DITA content.
ann.jensen
Posts: 312
Joined: Wed Jun 17, 2015 10:19 am

Title for prereq, context, postreq elements

Post 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
chrispitude
Posts: 918
Joined: Thu May 02, 2019 2:32 pm

Re: Title for prereq, context, postreq elements

Post by chrispitude »

Hi Ann,

DIfferent transformation types are customized in different ways. What transformation types are you using?
Radu
Posts: 9246
Joined: Fri Jul 09, 2004 5:18 pm

Re: Title for prereq, context, postreq elements

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
ann.jensen
Posts: 312
Joined: Wed Jun 17, 2015 10:19 am

Re: Title for prereq, context, postreq elements

Post 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
chrispitude
Posts: 918
Joined: Thu May 02, 2019 2:32 pm

Re: Title for prereq, context, postreq elements

Post 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
(3.79 KiB) Downloaded 134 times

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
image.png (35.99 KiB) Viewed 1463 times

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.
LASSE_MLE
Posts: 33
Joined: Mon Dec 05, 2022 3:24 pm

Re: Title for prereq, context, postreq elements

Post 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!
Post Reply