Automatic numbering in <equation-block/>
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 16
- Joined: Thu Dec 10, 2020 11:00 am
Automatic numbering in <equation-block/>
I use:
oXygen XML Editor 22.1, build 2020100710
transformation scenario - DITA Map PDF - based on XSL-FO
customization directory - according to oXygen's instructions
I want to get an automatic numbering in <equation-block/> and right alignmet too, so I use the tempalate:
<xsl:template match="*[contains(@class, ' equation-d/equation-block ')]">
<fo:table text-align="right" border = "0pt" margin-top="5mm">
<fo:table-column column-width="87.5mm"/>
<fo:table-column column-width="87.5mm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell border = "0pt" height="10.0mm">
<fo:block><xsl:apply-templates select="*[contains(@class,' topic/image ')]"/></fo:block>
</fo:table-cell>
<fo:table-cell border = "0pt">
<fo:block>
<xsl:text>(</xsl:text>
<xsl:value-of select="count(preceding::equation-block[not(descendant::equation-block)])+1" />
<xsl:text>)</xsl:text>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>
It's working template, but I have lost working formulas references:
for example <xref href="#topicID/equation-blockID" format="dita">see formula</xref> - it's just blue text.
I want working formulas reference and an automatic numbering in <equation-block/>.
Moreover, I want the links to be displayed as formula numbers that appear in the text.
Thanks in advance!
oXygen XML Editor 22.1, build 2020100710
transformation scenario - DITA Map PDF - based on XSL-FO
customization directory - according to oXygen's instructions
I want to get an automatic numbering in <equation-block/> and right alignmet too, so I use the tempalate:
<xsl:template match="*[contains(@class, ' equation-d/equation-block ')]">
<fo:table text-align="right" border = "0pt" margin-top="5mm">
<fo:table-column column-width="87.5mm"/>
<fo:table-column column-width="87.5mm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell border = "0pt" height="10.0mm">
<fo:block><xsl:apply-templates select="*[contains(@class,' topic/image ')]"/></fo:block>
</fo:table-cell>
<fo:table-cell border = "0pt">
<fo:block>
<xsl:text>(</xsl:text>
<xsl:value-of select="count(preceding::equation-block[not(descendant::equation-block)])+1" />
<xsl:text>)</xsl:text>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>
It's working template, but I have lost working formulas references:
for example <xref href="#topicID/equation-blockID" format="dita">see formula</xref> - it's just blue text.
I want working formulas reference and an automatic numbering in <equation-block/>.
Moreover, I want the links to be displayed as formula numbers that appear in the text.
Thanks in advance!
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Automatic numbering in <equation-block/>
Hi,
The original DITA formula element probably has an @id attribute defined on it and your XSL template does not use that ID to generate an equivalent ID on the fo:table that it creates, so the original @id attribute is not propagated to the XSL-FO elements.
I think something like this might work:
That call-template to the "commonattributes" should propagate the ID attribute value from the DITA element as an ID attribute on the fo:table element.
Regards,
Radu
The original DITA formula element probably has an @id attribute defined on it and your XSL template does not use that ID to generate an equivalent ID on the fo:table that it creates, so the original @id attribute is not propagated to the XSL-FO elements.
I think something like this might work:
Code: Select all
<xsl:template match="*[contains(@class, ' equation-d/equation-block ')]">
<fo:table text-align="right" border = "0pt" margin-top="5mm">
<xsl:call-template name="commonattributes"/>
........
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Automatic numbering in <equation-block/>
Hi,
About the link text, I think this is feasible but a little bit harder to do. The link text is computed in the pre-processing stage, before the XSL-FO output is generated from the DITA content.
If you look inside this XSLT stylesheet dita-ot/plugins/org.dita.base/xsl/preprocess/topicpullImpl.xsl
there is a template which computes the link text for links to figures for example:
and you probably need something similar for computing the link text for equations.
To add extra XSLT templates to the preprocessing stage a PDF customization folder is not enough, you need to create your own PDF plugin and in the plugin.xml you need to extend this extension point dita.xsl.topicpull to provide an XSLT stylesheet which can override templates or add new templates to the base XSLT processing. Something like:
An alternative to adding a template in the pre-processing stage might be to override the template named "topic.xref" from dita-ot/plugins/org.dita.pdf2/xsl/fo/links.xsl which can be done with a PDF customization folder and somehow compute the title of the target element there.
Regards,
Radu
About the link text, I think this is feasible but a little bit harder to do. The link text is computed in the pre-processing stage, before the XSL-FO output is generated from the DITA content.
If you look inside this XSLT stylesheet dita-ot/plugins/org.dita.base/xsl/preprocess/topicpullImpl.xsl
there is a template which computes the link text for links to figures for example:
Code: Select all
<xsl:template match="*[contains(@class, ' topic/fig ')][*[contains(@class,' topic/title ')]]" mode="topicpull:resolvelinktext">
To add extra XSLT templates to the preprocessing stage a PDF customization folder is not enough, you need to create your own PDF plugin and in the plugin.xml you need to extend this extension point dita.xsl.topicpull to provide an XSLT stylesheet which can override templates or add new templates to the base XSLT processing. Something like:
Code: Select all
<feature extension="dita.xsl.topicpull" file="topicpullCustom.xsl" xml:base="."/>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service