docbook-apps

  • 1.  gentext problem

    Posted 11-13-2008 10:51
    Hello,
    I want to use gentext for generating localized name strings for navigation tabs in our web help. For now it applies only to index tab.
    In my stylesheet I use this template call to generate approriate language string for index.
    <xsl:if test="$generate.webhelp.index != 0">



    <xsl:call-template name="gentext">
    <xsl:with-param name="key" select="'index'" />
    </xsl:call-template>


    </xsl:if>

    Nevertheless I do not get string for index in Czech but rather in English. I am wondering what I am doing wrong becase I use the same call elsewhere in the stylesheet for breadcrumb navigation.

    <xsl:when test="$current.node = //d:index">
    <xsl:if test="not(//d:index/d:title)">

    <xsl:call-template name="gentext">
    <xsl:with-param name="key" select="'index'"/>
    </xsl:call-template>

    </xsl:if>
    </xsl:when>


    Pavel Škopík



  • 2.  Re: [docbook-apps] gentext problem

    Posted 11-13-2008 11:32
    Skopik Pavel wrote:

    > I want to use gentext for generating localized name strings for navigation tabs in our web help. For now it applies only to index tab.
    > In my stylesheet I use this template call to generate approriate language string for index.
    > <xsl:if test="$generate.webhelp.index != 0">
    >
    >
    >
    > <xsl:call-template name="gentext">
    > <xsl:with-param name="key" select="'index'" />
    > </xsl:call-template>
    >

    >
    > </xsl:if>
    >
    > Nevertheless I do not get string for index in Czech but rather in English.

    What is the current node for this piece of XSLT? gentext template
    computes language for the current node, when there is no current node or
    it is "wrong" you will get default language (en). You can try something
    like:

    <xsl:call-template name="gentext">
    <xsl:with-param name="key" select="..."/>
    <xsl:with-param name="lang">
    <xsl:call-template name="l10n.language">
    <xsl:with-param name="target" select="/"/>
    </xsl:call-template>
    </xsl:with-param>
    </xsl:call-template>


    --
    ------------------------------------------------------------------
    Jirka Kosek e-mail: jirka@kosek.cz http://www.kosek.cz
    ------------------------------------------------------------------
    Profesionální školení a poradenství v oblasti technologií XML.
    Podrobný prehled školení http://xmlguru.cz/skoleni/
    ------------------------------------------------------------------
    Nejbližší termíny školení:
    ** XSLT 16.-19.9.2008 ** XML schémata 21.-23.10. **
    ** XSL-FO 18.-19.11.2008 ** XML pro vývojáre 16.-18.12. **
    ------------------------------------------------------------------
    http://docbook.cz Stránky o dokumentacním formátu DocBook
    http://xmlguru.cz Blog mostly about XML for English readers
    ------------------------------------------------------------------




  • 3.  RE: [docbook-apps] gentext problem

    Posted 11-13-2008 11:55
    Thank you for your help.
    Your example did the trick. I only had to extend the selection on the xml:lang attribute.
    This templete generates HTML files with navigation tabs (which contain table of contents, search form and index). So there is actually no node processed regarding the DocBook source files.

    <xsl:if test="$generate.webhelp.index != 0">



    <xsl:call-template name="gentext">
    <xsl:with-param name="key" select="'index'"/>
    <xsl:with-param name="lang">
    <xsl:call-template name="l10n.language">
    <xsl:with-param name="target" select="/*[@xml:lang]"/>
    </xsl:call-template>
    </xsl:with-param>
    </xsl:call-template>


    </xsl:if>

    Pavel Škopík