A proposal for glossary stylesheet processing
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 36
- Joined: Tue Feb 21, 2012 8:22 pm
- Location: Rotterdam, the Netherlands
- Contact:
A proposal for glossary stylesheet processing
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
Kind Regards,
Reinier Kleipool,
Course Materials editor,
Open Source Academy
http://www.OpenSourceAcademy.eu
Reinier Kleipool,
Course Materials editor,
Open Source Academy
http://www.OpenSourceAcademy.eu
-
- Posts: 36
- Joined: Tue Feb 21, 2012 8:22 pm
- Location: Rotterdam, the Netherlands
- Contact:
Re: A proposal for glossary stylesheet processing
Forgot to include glossary-attrs.xsl:
Please also have a look at my post about abbreviated-form
Code: Select all
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="2.0">
<xsl:attribute-set name="__glossary__label">
<xsl:attribute name="space-before">20pt</xsl:attribute>
<xsl:attribute name="space-after">20pt</xsl:attribute>
<xsl:attribute name="font-size">20pt</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="__glossary__group-head">
<!-- <xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="border-bottom">solid 0.5pt black</xsl:attribute>
<xsl:attribute name="end-indent">4cm</xsl:attribute>
<xsl:attribute name="space-before">10pt</xsl:attribute>-->
<xsl:attribute name="span">all</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="__glossary__term">
<xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="space-before">3pt</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="__glossary__def">
</xsl:attribute-set>
<xsl:attribute-set name="__glossary__abbrevs">
</xsl:attribute-set>
<xsl:attribute-set name="__glossary__abbrevs-label">
<xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="__glossary__acronyms">
</xsl:attribute-set>
<xsl:attribute-set name="__glossary__acronyms-label">
<xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="__glossary__synonyms">
</xsl:attribute-set>
<xsl:attribute-set name="__glossary__synonyms-label">
<xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:attribute-set>
</xsl:stylesheet>
Kind Regards,
Reinier Kleipool,
Course Materials editor,
Open Source Academy
http://www.OpenSourceAcademy.eu
Reinier Kleipool,
Course Materials editor,
Open Source Academy
http://www.OpenSourceAcademy.eu
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: A proposal for glossary stylesheet processing
Hi Reinier,
If you want these changes to be included in future DITA OT distributions, maybe you should add an issue at:
https://github.com/dita-ot/dita-ot/issues
Regards,
Radu
If you want these changes to be included in future DITA OT distributions, maybe you should add an issue at:
https://github.com/dita-ot/dita-ot/issues
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service