0

私は次の構造を持っています

    <informalfigure xmlns="http://docbook.org/ns/docbook">
      <info>
        <bibliosource>Photo: John Doe</bibliosource>
      </info>
      <mediaobject>
        <imageobject>
          <imagedata contentdepth="30mm" contentwidth="35mm" fileref="path/to/img.jpg"/>
        </imageobject>
      </mediaobject>
      <caption>
        <para>Here goes the caption for the image</para>
      </caption>
    </informalfigure>

<imagedata><caption>レンダリングされますが、<bibliosource>変換後にはなくなります。

変換に を使用しています...適切に変換されるdocbook-xsl-1.77.0/xhtml/docbook.xslように xslt をどこで/どのように変更するかについてのガイダンスが必要です。<bibliosource>

ありがとう!

4

1 に答える 1

1

これが簡単な解決策です。以下を XHTML カスタマイズ レイヤーに追加します。

<xsl:template match="d:caption">
  <div>
    <xsl:apply-templates select="." mode="common.html.attributes"/>
    <xsl:call-template name="id.attribute"/>
    <xsl:if test="@align = 'right' or @align = 'left' or @align='center'">
      <xsl:attribute name="align"><xsl:value-of select="@align"/></xsl:attribute>
    </xsl:if>
    <xsl:apply-templates/>
   </div>
   <div><xsl:value-of select="../d:info/d:bibliosource"/></div>   <!-- This line added -->
</xsl:template>

上記は、名前空間を認識するXSLT スタイルシート ( docbook-xsl-ns ) で機能します。

名前空間を認識しないスタイルシート ( docbook-xsl ) を使用する場合、対応するカスタマイズは次のようになります。

<xsl:template match="caption">
  <div>
    <xsl:apply-templates select="." mode="common.html.attributes"/>
    <xsl:call-template name="id.attribute"/>
    <xsl:if test="@align = 'right' or @align = 'left' or @align='center'">
      <xsl:attribute name="align"><xsl:value-of select="@align"/></xsl:attribute>
    </xsl:if>
    <xsl:apply-templates/>
   </div>
   <div><xsl:value-of select="../blockinfo/bibliosource"/></div>   <!-- This line added; note blockinfo -->
</xsl:template>

要素のテキストは、キャプションのすぐ下に<bibliosource>個別に表示されます。<div>元のテンプレートは、graphics.xsl にあります。

于 2013-08-19T15:44:26.160 に答える