docbook / xslTNG

DocBook xslTNG Stylesheets
https://xsltng.docbook.org
MIT License
41 stars 20 forks source link

Custom Template does not work (in Version 2.1.7) #409

Closed frank-steimke closed 9 months ago

frank-steimke commented 10 months ago

Hi Norm, i had to change the Headline for Chapters. For the first two chapters i want no token before the content. I took quite a while for me to understand that i have to create a custom localization (because i thought that localization is somehow related to translation from english to the german or other languages. Changing the headline format is not a matter of translation, so why should i look in the configuration file for the german language? But now i understand that localization also means configuation for my place.)

I followed the instructions in section 4.4.2: "Overriding mappings, groups, etc." of the reference Guide and created an custom localization like this:

<xsl:variable name="v:custom-localizations" xmlns:l="http://docbook.org/ns/docbook/l10n"
        xmlns:lt="http://docbook.org/ns/docbook/l10n/templates">
        <locale xmlns="http://docbook.org/ns/docbook/l10n/source" language="de"
            english-language-name="German">
            <group name="title-numbered">
                <template match="self::db:chapter[count(preceding-sibling::db:chapter) lt 2]">
                    <label/>
                    <separator/>
                    <content/>
                </template>
            </group>
        </locale>
    </xsl:variable>

But it had no effect at all. I am not sure, maybe i had some namespace related errors in my file. However, i tried to understand the mechanism of adding custom templates into the default templates,

I think there is (or has been in 2.1.7) a bug in xform-local.xsl with templates in the mp:expand-l10n-template mode. It did not handle the elements within the customized template the way i would expect. There was also an unconditional xsl:message. I took this as a sign that this code fragment is work in progress. I made some changes, and now it works for me. Maybe you can have a look at the attached file.

I tried to fork the repo so that you could pull, but i did not dare to do so. I don't understand the build mechanism (i use only the xslt part of the releases in my project), so i thought it is safe to send you the one isolated file).

xform-locale.zip

Greetings, Frank

frank-steimke commented 9 months ago

Well, i have tried again with a fresh installation of 2.1.9 and carefuilly reading of the instructions. Everything works fine.

I'm afraid I got tangled up somehow. However, i will close this issue.

Greetings, Frank