Incompatibility between sorted glossary and fo:list?

Here should go questions about transforming XML with XSLT and FOP.
29terms
Posts: 2

Incompatibility between sorted glossary and fo:list?

Thu Nov 12, 2015 1:57 pm

Hello team,

I have a glossary in the form of a bookmap, containing a glossarylist with many topicrefs towards the different terms (one DITA file and glossentry per term). The objective is to produce an XSL-FO list (fo:list-block), containing the terms sorted alphabetically by glossterm, in a PDF output.

> FO list

The following code partially produces the desired result, an XSL-FO list, but does not sort the terms alphabetically. If I replace

Code: Select all

"ot-placeholder:glossarylist" mode="glossary"
with

Code: Select all

 "ot-placeholder:glossarylist//*[contains(@class, ' glossentry/glossentry ')]"
the same result is produced.

> Alphabetically sorted glossary

However, if I simply remove

Code: Select all

mode="glossary"
the code also partially produces the desired result, a glossary with all terms sorted alphabetically by glossterm, but does not produce an XSL-FO list. I also no longer have any images in the PDF output.

Any ideas as to how to resolve this issue?!

Code: Select all

  <xsl:template match="ot-placeholder:glossarylist" mode="glossary">
    <fo:page-sequence master-reference="glossary-sequence" xsl:use-attribute-sets="__force__page__count" initial-page-number="1">
      <xsl:call-template name="insertGlossaryStaticContents"/>
      <fo:flow flow-name="xsl-region-body">
        <fo:block xsl:use-attribute-sets="body__toplevel">
          <xsl:for-each select="//*[contains(@class, 'glossentry/glossentry')]">
            <xsl:sort select="glossterm" order="ascending"/>
            <xsl:apply-templates/>
          </xsl:for-each>
        </fo:block>
      </fo:flow>
    </fo:page-sequence>
  </xsl:template>
 
  <xsl:template match="ot-placeholder:glossarylist//*[contains(@class, ' glossentry/glossentry ')]">
    <fo:block>
      <xsl:call-template name="commonattributes"/>
      <fo:block xsl:use-attribute-sets="__glossary">
        <xsl:attribute name="id">
          <xsl:call-template name="generate-toc-id"/>
        </xsl:attribute>
        <fo:list-block provisional-label-separation="1cm">
          <fo:list-item space-after="15pt">
            <fo:list-item-label start-indent="-1cm" end-indent="12cm">
              <fo:block>
                <fo:inline 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:inline>
              </fo:block>
            </fo:list-item-label>
            <fo:list-item-body start-indent="4.5cm">
              <fo:block page-break-inside="avoid">
                <fo:inline xsl:use-attribute-sets="__glossary__def">
                  <xsl:apply-templates select="*[contains(@class, ' glossentry/glossdef ')]/node()"/>
                </fo:inline>
              </fo:block>
              <xsl:apply-templates select="*[contains(@class, ' glossentry/glossBody ')]"/>
              <fo:block space-before="5pt" keep-with-previous.within-page="always">
                <fo:inline>
                  <xsl:for-each select="descendant-or-self::*[contains(@class, ' glossentry/glossSymbol ')]">
                    <fo:external-graphic xsl:use-attribute-sets="CoriolisGlossSymbol">
                      <xsl:attribute name="src">
                        url(
                        <xsl:value-of select="@href"/>
                        )
                      </xsl:attribute>
                    </fo:external-graphic>
                    <xsl:apply-templates/>
                  </xsl:for-each>
                </fo:inline>
              </fo:block>
            </fo:list-item-body>
          </fo:list-item>
        </fo:list-block>
      </fo:block>
    </fo:block>
  </xsl:template>

Many thanks for your help!
radu_pisoi
Posts: 318
Location: Craiova

Re: Incompatibility between sorted glossary and fo:list?

Mon Nov 16, 2015 5:07 pm

Hi,

You can find a similar discussion here: topic11283.html

Have you tried the sorting mechanism proposed by Eliot Kimber?

However, it's recommend to address questions like these to the DITA-OT users group.
Radu Pisoi
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
29terms
Posts: 2

Re: Incompatibility between sorted glossary and fo:list?

Mon Nov 30, 2015 4:49 pm

Thank you Radu.

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 1 guest