DITA and XMetaL Discussion
jlm05 January 11, 2012 at 9:06 pm
TOPLEAF: Cannot get image to bind to previous paragraphJanuary 11, 2012 at 9:06 pmParticipants 4Replies 5Last Activity 11 years ago
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.gjn2066 January 13, 2012 at 3:11 am
Reply to: TOPLEAF: Cannot get image to bind to previous paragraphJanuary 13, 2012 at 3:11 am
The answer depends on the form of markup you are using. I am currently looking at an example with the following structure:
and the [u]Bind to previous[/u] 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 [u]Bind element content[/u] on fig.
Does this sound as if it might apply to you? If not can you provide more specific details of your markup.
Geoffjlm05 January 13, 2012 at 1:09 pm
Reply to: TOPLEAF: Cannot get image to bind to previous paragraphJanuary 13, 2012 at 1:09 pm
Thanks for responding.
We don't use the fig tag for images. Our markup is typically just:
Janicegjn2066 January 16, 2012 at 4:19 pm
Reply to: TOPLEAF: Cannot get image to bind to previous paragraphJanuary 16, 2012 at 4:19 pm
I think I see what's happening. Setting the [u]Bind to previous[/u] 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 [u]did[/u] 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 [u]block[/u] 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 [u]inline[/u] 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:
Does this help?
Geoffjlm05 January 17, 2012 at 1:58 pm
Reply to: TOPLEAF: Cannot get image to bind to previous paragraphJanuary 17, 2012 at 1:58 pm
I had earlier tried having the image as a block element without the enclosing
, but the binding still didn't work.
I think the most structurally sound option would be to change the
. Tedious but doable, and this is a fairly minor issue.
Thanks again for your help,
- You must be logged in to reply to this topic.