Pages: 1
Print
Author Topic: TOPLEAF: Cannot get image to bind to previous paragraph  (Read 3162 times)
jlm05
Member

Posts: 79


« on: January 11, 2012, 03:06:08 PM »

I'm trying to configure the stylesheet so that images do not display at the top of a page - they should always be with the previous paragraph, which often contains some information about the image.

I've tried configuring the image tag to bind to the previous paragraph, but because image tags are always within p tags, that doesn't work.

Even if I insert an image tag without an enclosing p tag, the images is not with the previous paragraph.

Is there any way to configure this? Can I set up a context so that paragraphs that contain image tags are bound to the previous paragraph? The information in the Mapping Guide would seem to indicate that you can only set up a context to find a tag within a tag, not a tag that contains another tag.
Logged
gjn2066
Member

Posts: 60


WWW
« Reply #1 on: January 12, 2012, 09:11:13 PM »

The answer depends on the form of markup you are using. I am currently looking at an example with the following structure:

   <p>Previous para.</p>
   <p>
      <fig><image placement="inline" .../></fig>
   </p>


and the Bind to previous is set on the fig rather than the image.

This seems to work fine. If the image has an associated title (before or after), it can be included in the bound material by also setting Bind element content on fig.

Does this sound as if it might apply to you? If not can you provide more specific details of your markup.

Geoff
Logged
jlm05
Member

Posts: 79


« Reply #2 on: January 13, 2012, 07:09:40 AM »

Thanks for responding.

We don't use the fig tag for images. Our markup is typically just:

<p>Previous paragraph.</p>
<p><image src=".."/></p>

Janice
Logged
gjn2066
Member

Posts: 60


WWW
« Reply #3 on: January 16, 2012, 10:19:26 AM »

I think I see what's happening. Setting the Bind to previous on the image is binding to the (otherwise empty) enclosing para. But this para is not itself bound to the preceding para. My solution worked because the enclosing fig element did bind to the previous para.

This is a case where the available markup is not really adequate to fully express your requirements, but there are a couple of minor changes which could get you the desired result:
  • If the image has to bind to the previous para, then it must itself be a block element and therefore needs no enclosing p. Once this is done, the bind on the image will be effective.
  • If the image is regarded as an inline element, then it can't do any para binding itself. In this case you will need some means of applying the bind to the enclosing p, which would then act like fig in my earlier example. Suggest something like:
       <p>...preceding text...</p>
       <p outputclass="bindToPrev"><image .../></p>


Does this help?

Geoff
« Last Edit: January 16, 2012, 10:26:21 AM by gjn2066 » Logged
jlm05
Member

Posts: 79


« Reply #4 on: January 17, 2012, 07:58:20 AM »

I had earlier tried having the image as a block element without the enclosing <p>, but the binding still didn't work.

I think the most structurally sound option would be to change the <p><image></p> to <fig><image><fig>. Tedious but doable, and this is a fairly minor issue.

Thanks again for your help,

Janice
Logged
gjn2066
Member

Posts: 60


WWW
« Reply #5 on: January 17, 2012, 02:01:42 PM »

Strange. If you removed the enclosing <p>, the bind should have worked fine.

If you send me the stylesheet I could have a look at what's happening.

Geoff
Logged
Pages: 1
Print
Jump to: