Wrapping two elements in container <div>

Version

Date

Changes

Author

1.0

May 9, 2013

Initial version.

Lief

2.0

May 29, 2013

Fixed link to ContainerDiv.zip.

Lief

3.0

June 11, 2013

Added update with solution.

Lief

Description

At Study Hall I asked how I could wrap my Figure and Figure Title elements in an additional <div> so that I can treat the two of them as a single object. In my case, I want to float the figure group to either the right or the left and don't want the Figure Title to get separated from the Figure, which can sometimes happen.

Ben developed a solution where default.wwconfig was modified and created a super transform for content.xsl. I added an additional CSS class to Figure Title Open in the Designer file and a matching element in skin.css. This solution works just fine if the figure is not nested in a step (or nested some other way). If the figure is nested, everything below the figure is part of the container <div>. I don't know how to move the closing </div> of the container. Does anyone have any ideas?

In my sample project, I show the problem using some sample ePublisher documentation about popups. The source is DITA, but I suspect this would also be an issue for FrameMaker and MS Word content as well (if one were to need to wrap together two or more paragraph tags/styles).

Project files: ContainerDiv.zip

Update June 11, 2013

It turns out that the solution was a lot simpler than the one suggested on the Discussion page by Mike Hedblom. I simply needed an xsl:template to catch not one, but two different 'Figure Close' tags in content.xsl. Below is a portion of content.xsl. Reference the attached project file above if necessary.

 <xsl:template match="wwdoc:Paragraph[@stylename = 'Figure Title Open']" mode="wwmode:content">
  <wwexsldoc:Text disable-output-escaping="yes">&lt;div class="Figure_Container"&gt;</wwexsldoc:Text>
 </xsl:template>

 <xsl:template match="wwdoc:Paragraph[@stylename = 'Figure Close']" mode="wwmode:content">
  <wwexsldoc:Text disable-output-escaping="yes">&lt;/div&gt;</wwexsldoc:Text>
 </xsl:template>

  <!-- Added the template below. -->

 <xsl:template match="wwdoc:Paragraph[@stylename = 'Figure 1 Close']" mode="wwmode:content">
  <wwexsldoc:Text disable-output-escaping="yes">&lt;/div&gt;</wwexsldoc:Text>
 </xsl:template>

DevCenter/Projects/Wrapping Figure + Figure Title in a container <div> (last edited 2013-06-11 20:16:53 by LiefErickson)