docbook-apps

Re: [docbook-apps] Inheritance of customized generated text

  • 1.  Re: [docbook-apps] Inheritance of customized generated text

    Posted 10-10-2008 18:33
    Hi,
    A different approach is required here. A param such as $local.l10n.xml can
    have only one value, and there is no provision in XSLT to automatically
    merge nodes from two import layers into a single param.

    The stylesheets load the stock gentext into a param named $l10n.xml, and any
    customization gets loaded into the param named $local.l10n.xml. When
    gentext is needed, an xsl:choose statement first checks in $local.l10n.xml,
    and if not found there, falls back to $l10n.xml. If you want three layers,
    you would need a third param, and alter the xsl:choose to add another
    xsl:when.

    An alternative approach is to create two separate xml files that contain
    your gentext customizations, such as gentext-common.xml and
    gentext-special.xml (each has a root element of l:i18n). The common
    stylesheet would use:

    <xsl:param name="local.l10n.xml" select="document('gentext-common.xml')"/>

    and the special stylesheet would use:

    <xsl:param name="local.l10n.xml" select="document('gentext-special.xml')"/>

    Each has to be complete, however, as this would not merge them. If you need
    to merge them, then you would need to load each of them into different
    variables (not named local.l10n.xml), and use an XSLT process to assemble
    them into $local.l10n.xml using your merge logic.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net


    ----- Original Message -----
    From: "honyk" <j.tosovsky@email.cz>
    To: <docbook-apps@lists.oasis-open.org>
    Sent: Friday, October 10, 2008 10:30 AM
    Subject: [docbook-apps] Inheritance of customized generated text


    > For two my projects I would like to share customized gentext and after
    > importing this customization layer into next customization layer to
    > perform
    > additional changes to gentext, relative to appropriate project. I found
    > difficult to set it out properly.
    > If in db-common.xsl following changes are specified:
    > <i18n xmlns="http://docbook.sourceforge.net/xmlns/l10n/1.0">
    > <l10n language="en">
    > <context name="title">
    > <template name="example" text="Example %t"/>
    > <template name="informalexample" text="Example"/>
    > </context>
    > </l10n>
    > </i18n>
    >
    > and this layer is later imported using <xsl:import href="db-common.xsl"/>
    > into next layer with following code:
    > <xsl:param name="local.l10n.xml" select="document('')"/>
    > <i18n xmlns="http://docbook.sourceforge.net/xmlns/l10n/1.0">
    > <l10n language="en">
    > <context name="title">
    > <template name="example" text="%t"/>
    > </context>
    > </l10n>
    > </i18n>
    >
    > It seems all db-common changes are ignored and only these from second
    > layer
    > are used (i.e. informalexample is unknown). My list of changes is much
    > larger so it is quite important. Is there any mistake in my code or
    > different approach should be used instead?
    >
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >
    >
    >