Equation element remains empty in HTML

Post here questions and problems related to editing and publishing DITA content.
gbv34
Posts: 105
Joined: Thu Jan 20, 2022 12:36 pm

Equation element remains empty in HTML

Post by gbv34 »

Hello, everyone!
I crammed Eliot Kimber's tutorials about specialization and custom attributes. I got good results while following the step by steps and I start to better understand the principles between .mod, .ent and .dtd.

However, I am struggling now to understand how to debug a plugin based on mathml and using equations.
A client sent me a project were equations are written like this:

Code: Select all

<equation-inline>
	<mathml>
		<m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
		<m:mn>0</m:mn>
		<m:mo>.</m:mo>
		<m:mn>4</m:mn>
		<m:mi>L</m:mi>
		</m:math>
	</mathml>
</equation-inline>
So far, so good. However, when I publish my project with an HTML scenario, the source outputs an empty element instead of the maths:

Code: Select all

<span class="ph equation-inline"></span>
When exploring the dtd, it seems a .mod file contains elements that may produce the problem because Oxygen indicates that the bolded elements below are not declared. However, I assume %image and %basic.ph are regular elements in DITA-OT
.

Code: Select all

<!ENTITY % equation.cnt
    "#PCDATA |
    mathml |
    [b]%basic.ph; |
    %data.elements.incl; |
    %foreign.unknown.incl; |
    %image; |
    %txt.incl;[/b]
">
Is there any way or methodology to unravel this issue? Something that would help determining which file is problematic.
Thanks a lot for any feedback and support :)
------
Gaspard
Radu
Posts: 9423
Joined: Fri Jul 09, 2004 5:18 pm

Re: Equation element remains empty in HTML

Post by Radu »

Hi,

This does not look like a problem with the DTD, probably the XSLT stylesheets used to convert the DITA content to HTML simply have no processing in place for that mathml element.
You are probably using a custom DITA OT distribution, right?
As an example Oxygen's bundled DITA OT installation comes with this plugin created by Eliot Kimber pre-installed:
"OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT3.x/plugins/org.dita-community.dita13.html"
The plugin has a "org.dita-community.dita13.html/xsl/mathml-d2html.xsl" stylesheet which matches mathml elements and then serializes them further in the output HTML document.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
gbv34
Posts: 105
Joined: Thu Jan 20, 2022 12:36 pm

Re: Equation element remains empty in HTML

Post by gbv34 »

Hello, Radu!
Thanks for your answer.
Actually, I installed Eliott's plugin and checked if the XSL files are correctly installed. That's why I suspect a conflict or an override from the customer's plugin with this. And my current concern is to understand if there are any ways to trace and notice where the processing of this element would occur, because I don't have errors raised during the publishing. It's just the fact that somewhere the transformation doesn't apply as expected.
------
Gaspard
Radu
Posts: 9423
Joined: Fri Jul 09, 2004 5:18 pm

Re: Equation element remains empty in HTML

Post by Radu »

Hi,

I'm not sure how to help further, the XSLT "DITA-OT3.x/plugins/org.dita-community.dita13.html/xsl/mathml-d2html.xsl" has this template:

Code: Select all

  <xsl:template match="*[contains(@class, ' mathml-d/mathml ')]">
    <span>
  		<xsl:call-template name="commonattributes"/>
    	<xsl:apply-templates/>
  	</span>
  </xsl:template>
which should match the <mathml> DITA element, maybe you can add an xsl:message inside the template to see if it gets called. If not maybe you can set a priority attribute on the template to increase its priority.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
gbv34
Posts: 105
Joined: Thu Jan 20, 2022 12:36 pm

Re: Equation element remains empty in HTML

Post by gbv34 »

Interesting... Thanks for the pointer, it appears that the template declaration on my side is incomplete:

Code: Select all

  <xsl:template match="*[contains(@class, ' mathml-d/mathml ')]">
    <xsl:apply-templates/>
  </xsl:template>
I will look at the template's priority...
------
Gaspard
Post Reply