Merging related topics/information/tasks into a single list

26 views
Skip to first unread message

vicmor...@gmail.com

unread,
May 23, 2022, 6:12:10 AM5/23/22
to DITA-OT Users

Hi,

I'm trying to figure out how to add a customization that would have the reltable links in a single list, rather than splitting it in separate lists for concept, reference and task topics.

I'm trying to understand what's happing in these two files:
  • org.dita.base/xsl/common/related-links.xsl
  • org.dita.pdf2/xsl/fo/links.xsl
So far I've tried to overrule the templates with mode="related-links:get-group" to return 'concept' regardles of the matching type, but that still gets me the reltable references in three separate lists, however with the same heading.

I suppose I will figure this out in the end, it's probably something to do with this mysterious string that is being built up in related-links.xsl, but which is currently still puzzling me...

    <!-- Produces a string like "2 task task ;3 concept concept ;1 reference reference ;0  topic ;",
         where the numbers are priorities of each group, and the space-delimited words
         are the groups and link types (link/@type) which belong to that group. -->

But maybe there's a far more easy way to control the grouping of related topics? (I hope)

So if you happen to know, give me a hint! :)

Best regards,
Vic

vicmor...@gmail.com

unread,
May 31, 2022, 7:03:10 AM5/31/22
to DITA-OT Users
Hi,

for the community,  here's an answer to my question that was sent to me by mail. This was the customization that I was looking for, to merge the lists of reltable links into a single list.

Hi there,

What I did was to make a copy of xsl\fo\links.xsl I did: 

    <!-- Concepts, References, and Tasks are grouped together under the flag Related topics -->
    <xsl:template match="*[contains(@class, ' topic/link ')][@type='concept' or 'reference' or 'task']" mode="related-links:get-group"
        name="related-links:group.topics"
        as="xs:string">
        <xsl:text>topics</xsl:text>
    </xsl:template>

    <!-- Wrapper for concept, atsk, and reference groups: "Related topics" in a <div>. -->
    <xsl:template match="*[contains(@class, ' topic/link ')][@type='concept' or 'reference' or 'task']" mode="related-links:result-group"
            name="related-links:result.topics" as="element()?">
            <xsl:param name="links" as="node()*"/>
            <xsl:if test="normalize-space(string-join($links, ''))">
                <linklist class="- topic/linklist " outputclass="relinfo relconcepts">
                    <xsl:copy-of select="ancestor-or-self::*[@xml:lang][1]/@xml:lang"/>
                    <title class="- topic/title ">
                        <xsl:call-template name="getVariable">
                            <xsl:with-param name="id" select="'Related topics'"/>
                        </xsl:call-template>
                    </title>
                    <xsl:copy-of select="$links"/>
                </linklist>
            </xsl:if>
        </xsl:template>

And in cfg/common/vars/en.xml I added 
<variable id="Related topics">Related topics</variable>

Hope this helps,
Danielle Wong

I had been working in the same direction, but without success. Perhaps because I didn't assign a new @name to my customized templates...

Thanks, Danielle!

Best regards,
Vic

Op maandag 23 mei 2022 om 12:12:10 UTC+2 schreef vicmor...@gmail.com:
Reply all
Reply to author
Forward
0 new messages