Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to hide procedure/title label and number? "Procedure 1. " And hide in all languages? #574

Open
jodekirk opened this issue Dec 18, 2024 · 2 comments

Comments

@jodekirk
Copy link

I can't figure out how to override/remove auto gen procedure title and number text.
I found the closed issue about Section, but that was on pre release, so maybe it doesn't work anymore.

Tried adding to custom.xsl:

<xsl:variable name="v:custom-localizations">
  <locale xmlns="http://docbook.org/ns/docbook/l10n/source"
          language="en"
          english-language-name="English">
    <group name="list-of-titles">
      <template name="procedure">%c</template>
    </group>
    <group name="title-numbered">
      <template name="procedure">%c</template>
    </group>
  </locale>
</xsl:variable>

Error:

Type error evaluating (convert(@match)) at char 7 in expression in xsl:evaluate/@xpath on line 141 column 58 of gentext.xsl:
  XPTY0004  An empty sequence is not allowed as the @xpath attribute of xsl:evaluate
In function fp:lookup-localization-template on line 125 column 92 of gentext.xsl:
     invoked by xsl:iterate at file:/D:/docbook-xslTNG-2.5.0/xslt/modules/gentext.xsl#139
In function fp:lookup-localization-template on line 125 column 92 of gentext.xsl:
     invoked by function call at file:/D:/docbook-xslTNG-2.5.0/xslt/modules/gentext.xsl#98
During lazy evaluation of tailCallLoop(let $lang := ...) on line 95 of file:/D:/docbook-xslTNG-2.5.0/xslt/modules/gentext.xsl
In function fp:localization-template on line 91 column 60 of gentext.xsl:
     invoked by function call at file:/D:/docbook-xslTNG-2.5.0/xslt/modules/titles.xsl#177
During lazy evaluation of if($purpose eq "lot" and fn:contains(...)) then ... else ... on line 172 of file:/D:/docbook-xslTNG-2.5.0/xslt/modules/titles.xsl
  In template rule with match="*" on line 149 of titles.xsl
     invoked by xsl:apply-templates at file:/D:/docbook-xslTNG-2.5.0/xslt/modules/toc.xsl#115
  In template rule with match="element(Q{http://docbook.org/ns/docbook}section)" on line 110 of toc.xsl
     invoked by xsl:apply-templates at file:/D:/docbook-xslTNG-2.5.0/xslt/modules/toc.xsl#61
During lazy evaluation of xsl:apply-templates on line 61 of file:/D:/docbook-xslTNG-2.5.0/xslt/modules/toc.xsl
In template tp:toc on line 56 column 29 of toc.xsl:
     invoked by xsl:call-template (tail calls omitted) at file:/D:/docbook-xslTNG-2.5.0/xslt/modules/toc.xsl#37
  In template rule with match="element(Q{http://docbook.org/ns/docbook}book)" on line 13 of divisions.xsl
     invoked by xsl:apply-templates at file:/D:/docbook-xslTNG-2.5.0/xslt/main.xsl#91
  In template rule with match="/" on line 75 of main.xsl
     invoked by xsl:apply-templates at file:/D:/docbook-xslTNG-2.5.0/xslt/docbook.xsl#226
In template t:docbook on line 163 column 32 of docbook.xsl:
     invoked by xsl:call-template (tail calls omitted) at file:/D:/docbook-xslTNG-2.5.0/xslt/docbook.xsl#158
An empty sequence is not allowed as the @xpath attribute of xsl:evaluate
@jodekirk
Copy link
Author

jodekirk commented Jan 9, 2025

I tried using only the example in the documentation to update localizations but I get an error.
https://xsltng.docbook.org/guide/2.1.2/ch-localization#l10n-customization_s2

<xsl:variable name="v:custom-localizations">
  <locale xmlns="http://docbook.org/ns/docbook/l10n/source"
          language="en"
          english-language-name="English">
    <mappings>
      <gentext key="TableofContents">Contents</gentext>
    </mappings>
    <group name="title-numbered">
      <template name="appendix">%l%.%c</template>
    </group>
    <group name="xref-number">
      <template name="appendix">App. %l</template>
    </group>
  </locale>
</xsl:variable>

Error:

Type error evaluating (convert(@match)) at char 7 in expression in xsl:evaluate/@xpath on line 141 column 58 of gentext.xsl:
  XPTY0004  An empty sequence is not allowed as the @xpath attribute of xsl:evaluate
In function fp:lookup-localization-template on line 125 column 92 of gentext.xsl:
     invoked by xsl:iterate at file:/D:/docbook-xslTNG-2.5.0/xslt/modules/gentext.xsl#139
In function fp:lookup-localization-template on line 125 column 92 of gentext.xsl:
     invoked by function call at file:/D:/docbook-xslTNG-2.5.0/xslt/modules/gentext.xsl#98
In function fp:localization-template on line 91 column 60 of gentext.xsl:
     invoked by function call at file:/D:/docbook-xslTNG-2.5.0/xslt/modules/titles.xsl#180
During lazy evaluation of if($purpose eq "lot" and fn:contains(...)) then ... else ... on line 172 of file:/D:/docbook-xslTNG-2.5.0/xslt/modules/titles.xsl
  In template rule with match="*" on line 149 of titles.xsl
     invoked by xsl:apply-templates (tail calls omitted) at file:/D:/docbook-xslTNG-2.5.0/xslt/modules/titlepage.xsl#17
  In template rule with match="*" on line 242 of templates.xsl
     invoked by xsl:apply-templates at file:/D:/docbook-xslTNG-2.5.0/xslt/modules/templates.xsl#222
  In template rule with match="*" on line 242 of templates.xsl
     invoked by xsl:apply-templates at file:/D:/docbook-xslTNG-2.5.0/xslt/modules/templates.xsl#182
During lazy evaluation of xsl:apply-templates on line 182 of file:/D:/docbook-xslTNG-2.5.0/xslt/modules/templates.xsl
  In template rule with match="*" on line 160 of templates.xsl
     invoked by xsl:apply-templates at file:/D:/docbook-xslTNG-2.5.0/xslt/modules/sections.xsl#19
  In template rule with match="element(Q{http://docbook.org/ns/docbook}section)" on line 16 of sections.xsl
     invoked by xsl:apply-templates at file:/D:/docbook-xslTNG-2.5.0/xslt/modules/divisions.xsl#19
  In template rule with match="element(Q{http://docbook.org/ns/docbook}book)" on line 13 of divisions.xsl
     invoked by xsl:apply-templates at file:/D:/docbook-xslTNG-2.5.0/xslt/main.xsl#91
  In template rule with match="/" on line 75 of main.xsl
     invoked by xsl:apply-templates at file:/D:/docbook-xslTNG-2.5.0/xslt/docbook.xsl#226
In template t:docbook on line 163 column 32 of docbook.xsl:
     invoked by xsl:call-template (tail calls omitted) at file:/D:/docbook-xslTNG-2.5.0/xslt/docbook.xsl#158
An empty sequence is not allowed as the @xpath attribute of xsl:evaluate

If I remove the <group> tags it works without error, but that's the part I'm trying to customize.

How do I customize this without errors?

<l:template match="self::db:procedure">
  <lt:token key="Procedure"/>
  <lt:text> </lt:text>
  <lt:label/>
  <lt:separator/>
  <lt:content/>
</l:template>

to:

<l:template match="self::db:procedure">
  <lt:content/>
</l:template>

@frankarensmeier
Copy link

If you want to remove the title altogether, you can define an empty title page template in the variable v:templates.

Example:

    <xsl:variable name="v:templates" as="document-node()"
        xmlns:v="http://docbook.org/ns/docbook/variables">
        <db:procedure></db:procedure>
    </xsl:variable>

https://xsltng.docbook.org/guide/2.1.2/ch-implementation#header-templates "Title page" templates are actually used for lots (if not all?) formal elements.

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants