Move figure caption above the figure
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 9
- Joined: Fri Oct 31, 2014 12:15 am
Move figure caption above the figure
Post by Lachlan_Murray »
Hi,
I'm using Oxygen XML Editor 16.0 and outputting HTML WebHelp from DITA. Could someone tell me how to move figure captions from below the figure to above the figure?
In dita2htmlImpl.xsl, it looks like there was a patch at some point to move the figure caption below the figure. Basically, I want to reverse that change and move the caption back above the figure.
Thanks.
I'm using Oxygen XML Editor 16.0 and outputting HTML WebHelp from DITA. Could someone tell me how to move figure captions from below the figure to above the figure?
In dita2htmlImpl.xsl, it looks like there was a patch at some point to move the figure caption below the figure. Basically, I want to reverse that change and move the caption back above the figure.
Thanks.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Move figure caption above the figure
Post by sorin_ristache »
Hello,
For moving the caption back above the figure please replace the following lines between lines 1558 and 1562 in the file OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\plugins\org.dita.xhtml\xsl\xslhtml\dita2htmlImpl.xsl:
with the following lines:
For moving the caption back above the figure please replace the following lines between lines 1558 and 1562 in the file OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\plugins\org.dita.xhtml\xsl\xslhtml\dita2htmlImpl.xsl:
Code: Select all
<!-- OXYGEN PATCH START EXM-18109 EXM-28090 - moved image caption below. -->
<xsl:apply-templates select="*[contains(@class,' topic/image ')]|*[contains(@class,' topic/object ')]"/>
<xsl:call-template name="place-fig-lbl"/>
<xsl:apply-templates select="*[not(contains(@class,' topic/title '))][not(contains(@class,' topic/desc '))][not(contains(@class,' topic/image '))][not(contains(@class,' topic/object '))] |text()|comment()|processing-instruction()"/>
<!-- OXYGEN PATCH END EXM-18109 EXM-28090 -->
Code: Select all
<xsl:call-template name="place-fig-lbl"/>
<xsl:apply-templates select="*[not(contains(@class, ' topic/title '))][not(contains(@class, ' topic/desc '))] |text()|comment()|processing-instruction()"/>
Regards,
Sorin
<oXygen/> XML Editor Support
Sorin
<oXygen/> XML Editor Support
-
- Posts: 9
- Joined: Fri Oct 31, 2014 12:15 am
Re: Move figure caption above the figure
Post by Lachlan_Murray »
Thanks, Sorin. That worked.
In the HTML output there's a <br/> tag that gets inserted between the figure caption and the figure that I'd really like to get rid of. My captions are currently too far away from the figures, but I can't get them any closer using css because of the <br/> tag. I tried commenting out <xsl:value-of select="$newline"/> immediately below the piece of code you gave me to insert, but it didn't make any difference. Could you direct me to the location where that <br/> is specified?
I also uncommented lines 3747-3759 in dita2htmlImpl.xsl to restore the "Figure" prefix and figure numbering, in case that makes a difference.
In the HTML output there's a <br/> tag that gets inserted between the figure caption and the figure that I'd really like to get rid of. My captions are currently too far away from the figures, but I can't get them any closer using css because of the <br/> tag. I tried commenting out <xsl:value-of select="$newline"/> immediately below the piece of code you gave me to insert, but it didn't make any difference. Could you direct me to the location where that <br/> is specified?
I also uncommented lines 3747-3759 in dita2htmlImpl.xsl to restore the "Figure" prefix and figure numbering, in case that makes a difference.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Move figure caption above the figure
Post by sorin_ristache »
Sorry, there is no <br/> tag inserted between the figure caption and the figure. The code that I showed you to be replaced and also the entire <img> tag is inside a <div> tag like the following:
The line
inserts only a newline character, not a <br/> tag.
Maybe you use a different Oxygen version? Please tell me what Oxygen version number and build number you use (they are visible in the Help -> About dialog box) and also post the code that you have in the WebHelp page, including the <img> tag with the reference to the image file and the <br/> tag.
Code: Select all
<div class="fig fignone"><p class="figcap">IRIS TITLE</p>
<img class="image" src="../../images/Iris_sanguinea.jpg" height="166" width="125"></img>
</div>
Code: Select all
<xsl:value-of select="$newline"/>
Maybe you use a different Oxygen version? Please tell me what Oxygen version number and build number you use (they are visible in the Help -> About dialog box) and also post the code that you have in the WebHelp page, including the <img> tag with the reference to the image file and the <br/> tag.
Regards,
Sorin
<oXygen/> XML Editor Support
Sorin
<oXygen/> XML Editor Support
-
- Posts: 9
- Joined: Fri Oct 31, 2014 12:15 am
Re: Move figure caption above the figure
Post by Lachlan_Murray »
Hi Sorin,
Here's my build info: <oXygen/> XML Editor 16.0, build 2014070913
I think I may have found a solution. If I comment out lines 1593-1595 in dita2htmlImpl.xsl, then the <br/> tag does not get inserted between the figure caption and the figure. I commented out these lines in the topic.image template:
If I do not comment out the lines, here's the code that gets generated in the WebHelp page:
And here's the code that gets generated with the lines commented out:
I hope that commenting out those lines doesn't affect anything else. So far, everything else in the generated WebHelp looks okay.
Here's my build info: <oXygen/> XML Editor 16.0, build 2014070913
I think I may have found a solution. If I comment out lines 1593-1595 in dita2htmlImpl.xsl, then the <br/> tag does not get inserted between the figure caption and the figure. I commented out these lines in the topic.image template:
Code: Select all
<xsl:when test="@placement = 'break'">
<br/>
</xsl:when>
Code: Select all
<div class="fig fignone"><p class="figcap">Figure 2. Main tab in a command dialog box</p><br/><div class="imageleft"><img class="image imageleft" src="../images/Summarize_Main_tab.png"/></div><br/></div>
Code: Select all
<div class="fig fignone"><p class="figcap">Figure 2. Main tab in a command dialog box</p><div class="imageleft"><img class="image imageleft" src="../images/Summarize_Main_tab.png"/></div><br/></div>
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Move figure caption above the figure
Post by sorin_ristache »
Hi,
Now I understand, you have the placement=break attribute on the image element. No, commenting out that code doesn't affect anything else.
Now I understand, you have the placement=break attribute on the image element. No, commenting out that code doesn't affect anything else.
Regards,
Sorin
<oXygen/> XML Editor Support
Sorin
<oXygen/> XML Editor Support
-
- Posts: 9
- Joined: Fri Oct 31, 2014 12:15 am
Re: Move figure caption above the figure
Post by Lachlan_Murray »
Thanks. I'll take a look at those placement attributes. Just leaving the code commented out might be easier than resetting the attributes on all the images in our documentation. I'm assuming they're set that way because that's what we need in our current transformation from DITA to Eclipse Help.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Move figure caption above the figure
Post by sorin_ristache »
The default value of the placement attribute is inline. So it was explicitly set to break for separating each image from the surrounding text. This separation will occur in all types of output created from such an XML topic file.
Regards,
Sorin
<oXygen/> XML Editor Support
Sorin
<oXygen/> XML Editor Support
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)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ 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