gpt4 book ai didi

xml - 将标题或标题与图像对齐?

转载 作者:数据小太阳 更新时间:2023-10-29 02:06:31 25 4
gpt4 key购买 nike

我在 Ubuntu 13.04 上使用 DockBook 4.5 和 Apache FOP 1.1。 Docbook 翻译由 Ubuntu 提供,FOP 直接从 Apache 下载。

第一个问题:有人能告诉我如何确保图像的标题或标题与图像对齐吗?例如:

 Figure X: YYYYYY
+---------------+
| |
| Image |
| |
+---------------+

我知道我可以将 imagedata 与以下内容对齐:

<figure id="figure-xxx">
<title>YYYYY</title>

<mediaobject>
<imageobject>
<imagedata align="center" fileref="xxx.png" scale="75"/>
</imageobject>
<caption>XXX/caption>
</mediaobject>
</figure>

但是,align="center" 会产生如下内容:

 Figure X: YYYYYY
+---------------+
| |
| Image |
| |
+---------------+

align="right" 使情况变得更糟:

 Figure X: YYYYYY
+---------------+
| |
| Image |
| |
+---------------+

当我尝试将 align 标记添加到 figuretitlemediaobject imageobjectcaption,我收到类似于以下内容的错误:

element figure: validity error : No declaration for attribute align of element figure

和:

element mediaobject: validity error : No declaration for attribute align of element mediaobject

也许我又做错了什么。在尝试使文本环绕图像 (Block Image Right and Flow Text Around It?) 并将标题与图像对齐(这个问题)之后,我想知道 DocBook 是否可以在现实生活中处理图像。

那么我的第二个问题:有人知道 DocBook 是否支持现实生活中的图像吗?

编辑:对于第二个问题的答案,问题出在 Apache FOP 而不是 DocBook。

最佳答案

我假设“Docbook 翻译”的意思是 docbook-xsl (我认为确切的版本在这里并不重要,但通常很重要)。

您可以通过自定义 formal.title.properties 属性集来解决标题对齐问题。将此添加到您的自定义层:

<xsl:attribute-set name="formal.title.properties">
<xsl:attribute name="text-align">
<xsl:variable name ="align">
<xsl:value-of select=".//imagedata/@align"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="self::figure and $align !=''">
<xsl:value-of select="$align"/>
</xsl:when>
<xsl:otherwise>left</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:attribute-set>

含义:如果 imagedata 元素上有 align 值,则使用该值作为图形标题,否则使用“left”。

另见 http://www.sagehill.net/docbookxsl/TitleFontSizes.html#FormalTitleProperties .

关于xml - 将标题或标题与图像对齐?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19773563/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com