frameset.xsl 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?xml version="1.0"?>
  2. <!--
  3. This file is part of the DITA Open Toolkit project.
  4. Copyright 2007 Shawn McKenzie
  5. See the accompanying LICENSE file for applicable license.
  6. -->
  7. <!--
  8. Created by Robert Anderson August 2011, based on the sample
  9. frameset distributed with the original samples. Minor udpates:
  10. - Grab title of the map as the title
  11. - Update contentwin to use the first topic
  12. This is intended to create an initial, sample frameset when
  13. one is not already provided. Long term, users may wish to create
  14. a stable frameset using local styles and organization.
  15. -->
  16. <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  17. <xsl:import href="plugin:org.dita.base:xsl/common/dita-utilities.xsl"/>
  18. <xsl:import href="plugin:org.dita.base:xsl/common/output-message.xsl"/>
  19. <!-- Deprecated since 2.3 -->
  20. <xsl:variable name="msgprefix">DOTX</xsl:variable>
  21. <xsl:output method="html"
  22. encoding="UTF-8"
  23. indent="no"
  24. doctype-system="about:legacy-compat"
  25. omit-xml-declaration="yes"/>
  26. <xsl:param name="CSSPATH"/>
  27. <xsl:param name="OUTEXT" select="'.html'"/>
  28. <xsl:variable name="firsttopic">
  29. <xsl:variable name="f" select="/*/*[contains(@class, ' map/topicref ')][1]/descendant-or-self::*[@href][not(@processing-role='resource-only')]"/>
  30. <xsl:choose>
  31. <xsl:when test="$f">
  32. <xsl:choose>
  33. <xsl:when test="not($f[1]/@format) or $f[1]/@format = 'dita'">
  34. <xsl:call-template name="replace-extension">
  35. <xsl:with-param name="filename" select="$f[1]/@href"/>
  36. <xsl:with-param name="extension" select="$OUTEXT"/>
  37. </xsl:call-template>
  38. </xsl:when>
  39. <xsl:otherwise>
  40. <xsl:value-of select="$f[1]/@href"/>
  41. </xsl:otherwise>
  42. </xsl:choose>
  43. </xsl:when>
  44. <xsl:otherwise>
  45. <xsl:variable name="f" select="/*/descendant-or-self::*[@href][not(@processing-role='resource-only')]"/>
  46. <xsl:choose>
  47. <xsl:when test="not($f[1]/@format) or $f[1]/@format = 'dita'">
  48. <xsl:call-template name="replace-extension">
  49. <xsl:with-param name="filename" select="$f[1]/@href"/>
  50. <xsl:with-param name="extension" select="$OUTEXT"/>
  51. </xsl:call-template>
  52. </xsl:when>
  53. <xsl:otherwise>
  54. <xsl:value-of select="$f[1]/@href"/>
  55. </xsl:otherwise>
  56. </xsl:choose>
  57. </xsl:otherwise>
  58. </xsl:choose>
  59. </xsl:variable>
  60. <xsl:variable name="firsttopicAsHtml" select="$firsttopic"/>
  61. <xsl:template match="/">
  62. <html>
  63. <head>
  64. <title>
  65. <xsl:choose>
  66. <xsl:when test="/*/*[contains(@class,' topic/title ')]">
  67. <xsl:value-of select="normalize-space(/*/*[contains(@class,' topic/title ')])"/>
  68. </xsl:when>
  69. <xsl:when test="/*/@title">
  70. <xsl:value-of select="normalize-space(/*/@title)"/>
  71. </xsl:when>
  72. </xsl:choose>
  73. </title>
  74. <xsl:choose>
  75. <xsl:when test="$CSSPATH!=''">
  76. <link rel="stylesheet" type="text/css" href="concat($CSSPATH,'commonltr.css')"/>
  77. </xsl:when>
  78. <xsl:otherwise>
  79. <link rel="stylesheet" type="text/css" href="commonltr.css"/>
  80. </xsl:otherwise>
  81. </xsl:choose>
  82. </head>
  83. <frameset cols="30%,*">
  84. <frame name="tocwin" src="tocnav.html"/>
  85. <frame name="contentwin" src="{$firsttopicAsHtml}"/>
  86. </frameset>
  87. </html>
  88. </xsl:template>
  89. </xsl:stylesheet>