This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [docbook-apps] Writing Hebrew in docbook


Jirka Kosek wrote:


Hillel, add following template into your customization layer. It contains fix that I submited into CVS recently:


<xsl:template name="language.attribute">
  <xsl:param name="node" select="."/>

  <xsl:variable name="language">
    <xsl:choose>
      <xsl:when test="$l10n.gentext.language != ''">
        <xsl:value-of select="$l10n.gentext.language"/>
      </xsl:when>

<xsl:otherwise>
<!-- can't do this one step: attributes are unordered! -->
<xsl:variable name="lang-scope"
select="$node/ancestor-or-self::*
[@lang or @xml:lang][1]"/>
<xsl:variable name="lang-attr"
select="($lang-scope/@lang | $lang-scope/@xml:lang)[1]"/>


        <xsl:choose>
          <xsl:when test="string($lang-attr) = ''">
            <xsl:value-of select="$l10n.gentext.default.language"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="$lang-attr"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <xsl:if test="$language != ''">
    <xsl:attribute name="lang">
      <xsl:value-of select="$language"/>
    </xsl:attribute>
  </xsl:if>

<!-- FIXME: This is sort of hack, but it was the easiest way to add at least partial support for dir attribute -->
<xsl:copy-of select="ancestor-or-self::*[@dir][1]/@dir"/>
</xsl:template>


This seems to work on both my sample file in the bug report, and on the slightly more complicated Hebrew doc I am working on. I guess this looks good ;-).

Why is the support partial? Can you tell me what won't work?


Thanks for the effort,


Hillel.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]