Page 1 of 1
Adding a step number to a 1-step task
Posted: Tue Dec 06, 2022 4:51 am
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?
Re: Adding a step number to a 1-step task
Posted: Tue Dec 06, 2022 7:57 am
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
Re: Adding a step number to a 1-step task
Posted: Tue Dec 06, 2022 11:57 pm
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?
Re: Adding a step number to a 1-step task
Posted: Wed Dec 07, 2022 8:46 am
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
Re: Adding a step number to a 1-step task
Posted: Sat Aug 05, 2023 6:00 pm
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
Re: Adding a step number to a 1-step task
Posted: Mon Aug 07, 2023 11:56 am
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