A proposal for glossary stylesheet processing
Posted: Mon Jan 21, 2013 1:25 pm
Below are some extensions I made to the glossary processing to get better and nicer layout for glossary entries
These output stuff like:
Intel 64 (x86-64)
A 64-bit extension of IA-32, the 32-bit generation of the x86 instruction set. It supports vastly larger amounts of virtual memory and physical memory than is possible on IA-32, allowing programs to store larger amounts of data in memory. x86-64 also provides 64-bit general purpose registers and numerous other enhancements. The original specification was created by AMD, and has been implemented by AMD, Intel, VIA, and others. It is fully backwards compatible with 16-bit and 32-bit x86 code.
Synonyms: Intel 64
Acronyms: x86-64, x64, EM64T
Related Links
Intel Itanium architecture on page 227
Code: Select all
<!-- Glossary group headings -->
<xsl:template
match="ot-placeholder:glossarylist//*[contains(@class, ' glossgroup/glossgroup ')]">
<!-- <fo:block xsl:use-attribute-sets="__glossary__group-head">
<xsl:call-template name="commonattributes"/>-->
<xsl:apply-templates select="*[contains(@class,' topic/title ')]"/>
<!-- </fo:block>-->
</xsl:template>
<!-- Normal Glossary entry -->
<xsl:template
match="ot-placeholder:glossarylist//*[contains(@class, ' glossentry/glossentry ')]">
<fo:block>
<xsl:call-template name="commonattributes"/>
<fo:block>
<xsl:attribute name="id">
<xsl:call-template name="generate-toc-id"/>
</xsl:attribute>
<fo:block xsl:use-attribute-sets="__glossary__term">
<xsl:apply-templates
select="*[contains(@class, ' glossentry/glossterm ')]/node()"/>
<xsl:if
test="count(descendant-or-self::*[contains(@class, ' glossentry/glossAcronym ')]) gt 0">
<xsl:text> (</xsl:text>
<xsl:apply-templates
select="descendant-or-self::*[contains(@class, ' glossentry/glossAcronym ')][1]"/>
<xsl:text>)</xsl:text>
</xsl:if>
</fo:block>
<fo:block xsl:use-attribute-sets="__glossary__def">
<xsl:apply-templates
select="*[contains(@class, ' glossentry/glossdef ')]/node()"/>
<xsl:apply-templates select="*[contains(@class, ' glossentry/glossBody ')]"/>
<xsl:apply-templates select="*[contains(@class, ' topic/related-links ')]"/>
</fo:block>
</fo:block>
</fo:block>
</xsl:template>
<xsl:template match="*[contains(@class, ' glossentry/glossBody ')]">
<xsl:variable name="synonyms"
select="descendant-or-self::*[contains(@class, ' glossentry/glossSynonym ')]/node()"/>
<xsl:variable name="acronyms"
select="descendant-or-self::*[contains(@class, ' glossentry/glossAcronym ')]/node()"/>
<xsl:variable name="abbrevs"
select="descendant-or-self::*[contains(@class, ' glossentry/glossAbbreviation ')]/node()"/>
<xsl:if test="count($synonyms) gt 0">
<fo:block xsl:use-attribute-sets="__glossary__synonyms">
<fo:inline xsl:use-attribute-sets="__glossary__synonyms-label">
<xsl:call-template name="insertVariable">
<xsl:with-param name="theVariableID" select="'Synonyms'"/>
</xsl:call-template>
</fo:inline>
<xsl:for-each
select="descendant-or-self::*[contains(@class, ' glossentry/glossSynonym ')]">
<!-- <xsl:value-of select="string-join($abbrevs, ', ')"/>-->
<xsl:apply-templates select="."/>
<xsl:if test="position() lt last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</fo:block>
</xsl:if>
<xsl:if test="count($acronyms) gt 0">
<fo:block xsl:use-attribute-sets="__glossary__acronyms">
<fo:inline xsl:use-attribute-sets="__glossary__acronyms-label">
<xsl:call-template name="insertVariable">
<xsl:with-param name="theVariableID" select="'Acronyms'"/>
</xsl:call-template>
</fo:inline>
<xsl:value-of select="string-join($acronyms, ', ')"/>
</fo:block>
</xsl:if>
<xsl:if test="count($abbrevs) gt 0">
<fo:block xsl:use-attribute-sets="__glossary__abbrevs">
<fo:inline xsl:use-attribute-sets="__glossary__abbrevs-label">
<xsl:call-template name="insertVariable">
<xsl:with-param name="theVariableID" select="'Abbrevs'"/>
</xsl:call-template>
</fo:inline>
<xsl:for-each
select="descendant-or-self::*[contains(@class, ' glossentry/glossAbbreviation ')]">
<!-- <xsl:value-of select="string-join($abbrevs, ', ')"/>-->
<xsl:apply-templates select="."/>
<xsl:if test="position() lt last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</fo:block>
</xsl:if>
</xsl:template>
<xsl:template match="*[contains(@class, ' glossentry/glossSynonym ')]">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="*[contains(@class, ' glossentry/glossAbbreviation ')]">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="*[contains(@class, ' glossentry/glossAcronym ')]">
<xsl:apply-templates/>
</xsl:template>
Intel 64 (x86-64)
A 64-bit extension of IA-32, the 32-bit generation of the x86 instruction set. It supports vastly larger amounts of virtual memory and physical memory than is possible on IA-32, allowing programs to store larger amounts of data in memory. x86-64 also provides 64-bit general purpose registers and numerous other enhancements. The original specification was created by AMD, and has been implemented by AMD, Intel, VIA, and others. It is fully backwards compatible with 16-bit and 32-bit x86 code.
Synonyms: Intel 64
Acronyms: x86-64, x64, EM64T
Related Links
Intel Itanium architecture on page 227