2009年11月8日日曜日

JBossのテンプレートでDocBook - (5/8) -

DocBook PDFテンプレートを編集する

日本語フォントとイメージファイルの設定します。

『resources/j-docbook-xsl/xslt/org/jboss』フォルダーにある『common.xsl』ファイルと『pdf.xsl』ファイルを編集します。

common.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  ...
  <!-- <xsl:param name="l10n.gentext.default.language" select="'en'"/> -->
  <xsl:param name="l10n.gentext.default.language" select="'ja'"/>
  <xsl:param name="l10n.gentext.language" select="'ja-JP'"/>
  ...
言語設定を日本語に変更します。

pdf.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ...
  ...
  <!--<xsl:import href="http://docbook.sourceforge.net/release/xsl/1.72.0/fo/docbook.xsl"/>-->
  <xsl:import href="file:///C:/mybook/resources/docbook-xsl-1.75.2/fo/docbook.xsl"/>
  ...
  <!--<xsl:param name="fop.extensions" select="1"/>-->
  <!--<xsl:param name="fop1.extensions" select="0"/>-->
  <!--<xsl:param name="img.src.path"/>-->
  <xsl:param name="fop.extensions" select="0"/>
  <xsl:param name="fop1.extensions" select="1"/>
  <xsl:param
    name="img.src.path">file:///C:/mybook/resources/j-docbook-style/images/</xsl:param>
  <xsl:param name="keep.relative.image.uris" select="1"/>
  <xsl:param name="ignore.image.scaling" select="1"/>
  ...
  <xsl:template name="pickfont-sans">
    <xsl:variable name="font">
      <xsl:choose>
        <xsl:when test="$l10n.gentext.language = 'ja-JP'">
          <!--<xsl:text>KochiMincho,</xsl:text>-->
          <xsl:text>Sazanami-Gothic-Regular,</xsl:text>
          ...
  <xsl:template name="pickfont-serif">
    <xsl:variable name="font">
      <xsl:choose>
        <xsl:when test="$l10n.gentext.language = 'ja-JP'">
          <!--<xsl:text>KochiMincho,</xsl:text>-->
          <xsl:text>Sazanami-Gothic-Regular,</xsl:text>
          ...
  <xsl:template name="pickfont-mono">
    <xsl:variable name="font">
      <xsl:choose>
        <xsl:when test="$l10n.gentext.language = 'ja-JP'">
          <!--<xsl:text>KochiMincho,</xsl:text>-->
          <xsl:text>Sazanami-Gothic-Regular,</xsl:text>
          ...
DocBookスタイルシートのパスをローカルファイルに変更します。
prefix(file://)を付けて絶対パスで指定します。
fop.extensions,fop1.extensions,ignore.image.scalingのパラメータを変更、追加します。
イメージファイルを配置したフォルダのパスを設定します。
prefix(file://)を付けて絶対パスで指定します。
改行を入れずに一行で記述します。改行を入れるとエラーになります。
日本語フォントをKochiMinchoからSazanami-Gothic-Regularに変更します。