frameset.xsl 3.7 KB

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