Hi Bernard,

There are two issues.  One is that the @name attribute in a l:template element should be the name of the element you are pointing to, not pointing from.  So that should be name="sect1" instead of "xref".

The other is that unless you have section numbering turned on (if set section.autolabel="1"), then the context named "xref-number-and-title" is not applied because the target element sect1 does not have a number.  So context="xref" is used instead.

One other point: the insert.xref.page.number parameter is used to append a page reference to the normal generated text. In your case, you are replacing the normal generated text with a page reference, so you don't want that param set unless you want page references elsewhere.

So your customization should look like this:

    <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0";>
        <l:l10n language="de">
            <l:context name="title">
                <l:template name="table" text="Tabelle %t."/>
            </l:context>
            <l:context name="xref-number-and-title">
                <l:template name="table" text="(in Tabelle&#8820;%t&#8221;)"/>
            </l:context>
            <l:context name="xref">
                <l:template name="sect1" style="PageInParen" text=" (S. %p)"/>
            </l:context>
        </l:l10n>
    </l:i18n>


Bob Stayton
Sagehill Enterprises
[email protected]

On 9/26/2018 10:27 AM, Bernhard Kleine wrote:
I have the following xml example and the corresponding xls stylesheet.
The pagenumber, however, is not shown as S. 1, but [1] not respecting
the style for the pagenumer.
The insert.xref.page.number is set to yes.

I am working with Oxygen XML editor 20.1 on win7(64bit).

What is missing?

Regards

Bernhard

testref.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://docbook.org/xml/5.1/rng/docbookxi.rng";
schematypens="http://relaxng.org/ns/structure/1.0";?>
<?xml-model href="http://docbook.org/xml/5.1/sch/docbook.sch";
type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron";?>
<chapter xmlns="http://docbook.org/ns/docbook";  xml:lang="de"
     xmlns:xi="http://www.w3.org/2001/XInclude";
xmlns:ns5="http://www.w3.org/2000/svg";
     xmlns:ns="http://docbook.org/ns/docbook";
xmlns:xlink="http://www.w3.org/1999/xlink";
     version="5.1">
     <title>Nachtfalter</title>
     <para>Die bis Herbst 2018 fotografierten Nachtfalter
(Großschmetterlinge) gehören zu folgenden
         Schmetterlingsfamilien (in Klammern die Anzahl der bis Ende
Sept. 2018 gefundenen
         Arten):</para>
     <para><itemizedlist>
             <listitem>
                 <para>Zygaenidae - Widderchen (6)<xref
linkend="Zygaenidae" xrefstyle="PageInParen"
                     /></para>
             </listitem>
         </itemizedlist>
     </para>

     <sect1 xml:id="Zygaenidae" xreflabel="">
         <title>Zygaenidae - Widderchen </title>
         <table frame="none">
             <title>Zygaenida</title>
             <tgroup cols="2" align="center">
                 <tbody>

                     <row valign="middle" rowsep="0">
                         <entry>Beilfleck-Widderchen</entry>
                         <entry>Thymian/Bibernell-Widderchen</entry>
                     </row>
                 </tbody>
             </tgroup>
         </table>
     </sect1>
</chapter>

Falterbuechlein.xls

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
     <xsl:import
href="http://docbook.sourceforge.net/release/xsl-ns/current/fo/docbook.xsl"/>
     <xsl:param name="paper.type" select="'a4'"/>
     <xsl:param name="page.orientation" select="'portrait'"/>
     <xsl:param name="local.l10n.xml" select="document('')"/>
     <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0";>
         <l:l10n language="de">
             <l:context name="title">
                 <l:template name="table" text="Tabelle %t."/>
             </l:context>
             <l:context name="xref-number-and-title">
                 <l:template name="table" text="(in
Tabelle&#8820;%t&#8221;)"/>
                 <l:template name="xref" style="PageInParen" text=" (S.
%p)"/>
             </l:context>
         </l:l10n>
     </l:i18n>
</xsl:stylesheet>

Reply via email to