DocBook 5 rendering without abbrev tag

谁说我不能喝 提交于 2019-12-25 02:55:45

问题


My DocBook 5 document contains glossentry tags that contain abbrev tags. The abbrev tags do not seem to contribute anything whatsoever to the rendered HTML. I'm new to DocBook and XSLT. Where do I need to start looking to change this? I've been looking through the docs and aside from being surprised by this apparently being the default behaviour, I'm not sure where to look next to troubleshoot.

Setup: My DocBook file starts simply with <book xmlns:xl="http://www.w3.org/1999/xlink">. I point xsltproc only to a single XSL file, which contains exactly this:

<?xml version='1.0'?>
<xsl:stylesheet  
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:import href="/usr/share/sgml/docbook/xsl-stylesheets/html/docbook.xsl"/>

<xsl:output method="html"
            encoding="UTF-8"
            indent="no"/>
<xsl:param name="html.stylesheet" select="'main.css'"/>
<xsl:param name="generate.toc">
  book      toc,title
</xsl:param>
<xsl:param name="glossentry.show.acronym">yes</xsl:param>

</xsl:stylesheet>

回答1:


There is a parameter named glossentry.show.acronym that you can set to yes to ensure both "acronym and abbrev elements in the glossentry" are displayed. You can also set it to primary to ensure these elements are displayed as the primary text for an entry.

If you need more customization, you would need to add your own template overriding the one in the Docbook stylesheet, which is

<xsl:template match="d:glossentry/d:abbrev"> <xsl:apply-templates/> <xsl:if test="following-sibling::d:acronym|following-sibling::d:abbrev">, </xsl:if> </xsl:template>

and outputs the abbrev elements as a comma separated list.



来源:https://stackoverflow.com/questions/28869578/docbook-5-rendering-without-abbrev-tag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!