concept.xsl 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. This file is part of the DITA Open Toolkit project.
  4. Copyright 2016 Jarno Elovirta
  5. See the accompanying LICENSE file for applicable license.
  6. -->
  7. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  8. xmlns:related-links="http://dita-ot.sourceforge.net/ns/200709/related-links"
  9. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  10. version="2.0"
  11. exclude-result-prefixes="related-links xs">
  12. <!-- Concepts have their own group. -->
  13. <xsl:template match="*[contains(@class, ' topic/link ')][@type='concept']" mode="related-links:get-group"
  14. name="related-links:group.concept"
  15. as="xs:string">
  16. <xsl:text>concept</xsl:text>
  17. </xsl:template>
  18. <!-- Priority of concept group. -->
  19. <xsl:template match="*[contains(@class, ' topic/link ')][@type='concept']" mode="related-links:get-group-priority"
  20. name="related-links:group-priority.concept"
  21. as="xs:integer">
  22. <xsl:sequence select="3"/>
  23. </xsl:template>
  24. <!-- Wrapper for concept group: "Related concepts" in a <div>. -->
  25. <xsl:template match="*[contains(@class, ' topic/link ')][@type='concept']" mode="related-links:result-group"
  26. name="related-links:result.concept" as="element()">
  27. <xsl:param name="links" as="node()*"/>
  28. <xsl:if test="normalize-space(string-join($links, ''))">
  29. <linklist class="- topic/linklist " outputclass="relinfo relconcepts">
  30. <xsl:copy-of select="ancestor-or-self::*[@xml:lang][1]/@xml:lang"/>
  31. <title class="- topic/title ">
  32. <xsl:call-template name="getVariable">
  33. <xsl:with-param name="id" select="'Related concepts'"/>
  34. </xsl:call-template>
  35. </title>
  36. <xsl:copy-of select="$links"/>
  37. </linklist>
  38. </xsl:if>
  39. </xsl:template>
  40. </xsl:stylesheet>