Adding a step number to a 1-step task

Post here questions and problems related to editing and publishing DITA content.
mdslup
Posts: 167
Joined: Tue Mar 06, 2018 1:34 am

Adding a step number to a 1-step task

Post by mdslup »

In a DITA task file, if the taskbody > steps has only one STEP element, the resulting web output does not add the "1.".
Even if it's a single step, I still want the "1" to appear in the ::before area of the resulting HTML span. Where can I edit this option?
Radu
Posts: 8991
Joined: Fri Jul 09, 2004 5:18 pm

Re: Adding a step number to a 1-step task

Post by Radu »

Hi,

There does not seem to be a publishing parameter for this.
In the XSLT stylesheet "OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT3.x/plugins/org.dita.html5/xsl/task.xsl" there is an XML comment:

Code: Select all

<!-- Single step. Process any stepsection before the step (cannot appear after). -->
so that is the place where the decision is made. Probably an HTML customization plugin could override the xsl:template and change it so that it no longer takes this decision.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
mdslup
Posts: 167
Joined: Tue Mar 06, 2018 1:34 am

Re: Adding a step number to a 1-step task

Post by mdslup »

Can I request a feature enhancement for a future oxygen release? At least to make this a flag or an xsl extension point?
Radu
Posts: 8991
Joined: Fri Jul 09, 2004 5:18 pm

Re: Adding a step number to a 1-step task

Post by Radu »

Hi,

Hi, I added an improvement request based on what you proposed:
https://github.com/dita-ot/dita-ot/issues/4072

Maybe as a workaround you can match on the generated <div> element for that single step with a custom CSS stylesheet and add a "1." before it:

Code: Select all

div.step:before {
	content: "1. ";
}
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
danielsandes
Posts: 1
Joined: Sat Aug 05, 2023 5:50 pm

Re: Adding a step number to a 1-step task

Post by danielsandes »

Hi Radu,

Thanks for the code to add in the custom CSS stylesheet, it worked but I had to do additional customization. That is because the indent (padding) does not match the lists created when there are more than 1 step. This is also true for the child elements, such as <info> and <stepresult>, for those I had to manually add formatting to the CSS stylesheet as they are supposed to differ slightly from the <cmd> as well.

Another thing that I found is that the spacing between the marker 1. and the <cmd> text is not a standard space-character size. I ignored that, but all in all I would agree that it would be beneficial to have this as a transformation scenario option, as feature enhancement. All these small issues could be fixed there as when they are summed up in the CSS stylesheet it starts to get big. And I would want to avoid other elements that are not directly related to this issue being affected as well.

Would it be possible to reconsider the decision made in https://github.com/dita-ot/dita-ot/issues/4072?

Best,
Daniel
Radu
Posts: 8991
Joined: Fri Jul 09, 2004 5:18 pm

Re: Adding a step number to a 1-step task

Post by Radu »

Hi Daniel,
Maybe you can add a comment on this issue with the problems you mentioned above:
https://github.com/dita-ot/dita-ot/issues/4072
The alternative would be to create your own DITA OT plugin which adds an XSLT stylesheet which overrides from the base "task.xsl" I mentioned in this thread the XSLT template which takes this decision and thus you take full control over what's generated in the HTML for single step tasks.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply