map2javahelptoc.xsl 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!-- This file is part of the DITA Open Toolkit project hosted on
  3. Sourceforge.net. See the accompanying license.txt file for
  4. applicable licenses.-->
  5. <!-- (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved. -->
  6. <xsl:stylesheet version="2.0"
  7. xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  8. <!-- stylesheet imports -->
  9. <xsl:import href="plugin:org.dita.xhtml:xsl/xslhtml/map2TOC.xsl"/>
  10. <xsl:import href="plugin:org.dita.base:xsl/common/output-message.xsl"/>
  11. <xsl:import href="plugin:org.dita.base:xsl/common/dita-utilities.xsl"/>
  12. <!-- default "output extension" processing parameter ('.html')-->
  13. <xsl:param name="OUTEXT" select="'.html'"/><!-- "htm" and "html" are valid values -->
  14. <!-- Deprecated since 2.3 -->
  15. <xsl:variable name="msgprefix">DOTX</xsl:variable>
  16. <xsl:output
  17. method="xml"
  18. omit-xml-declaration="no"
  19. encoding="UTF-8"
  20. doctype-public="-//Sun Microsystems Inc.//DTD JavaHelp TOC Version 1.0//EN"
  21. doctype-system="http://java.sun.com/products/javahelp/toc_1_0.dtd"
  22. indent="yes"
  23. />
  24. <xsl:template match="*[contains(@class,' map/map ')]" mode="toctop">
  25. <toc version="2.0">
  26. <xsl:apply-templates select="*[contains(@class,' map/topicref ')]"/>
  27. </toc>
  28. </xsl:template>
  29. <xsl:template match="*[contains(@class,' map/topicref ')]" mode="tocentry">
  30. <xsl:param name="infile"/>
  31. <xsl:param name="outroot"/>
  32. <xsl:param name="outfile"/>
  33. <xsl:param name="nodeID"/>
  34. <xsl:param name="isFirst"/>
  35. <xsl:param name="subtopicNodes"/>
  36. <xsl:param name="title"/>
  37. <xsl:choose>
  38. <xsl:when test="(@toc and translate(@toc, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')='no')
  39. or (@processing-role='resource-only')">
  40. <!-- <xsl:variable name="results"> -->
  41. <!-- Process children nodes. -->
  42. <!-- <xsl:apply-templates select="$subtopicNodes"/> -->
  43. <xsl:apply-templates select="./*[contains(@class, ' map/topicref ')]"/>
  44. <!-- </xsl:variable> -->
  45. <!-- <xsl:text/> -->
  46. </xsl:when>
  47. <xsl:when test="$title">
  48. <tocitem text="{$title}">
  49. <xsl:if test="$outroot and $outroot!=''">
  50. <xsl:attribute name="target">
  51. <xsl:value-of select="translate($outroot, '\/.', '___')"/>
  52. </xsl:attribute>
  53. </xsl:if>
  54. <xsl:if test="@copy-to">
  55. <xsl:variable name="copyToWithoutExtension">
  56. <xsl:call-template name="replace-extension">
  57. <xsl:with-param name="filename" select="@copy-to"/>
  58. <xsl:with-param name="extension" select="''"/>
  59. </xsl:call-template>
  60. </xsl:variable>
  61. <xsl:attribute name="target">
  62. <xsl:value-of select="translate($copyToWithoutExtension, '\/.', '___')"/>
  63. </xsl:attribute>
  64. </xsl:if>
  65. <xsl:apply-templates select="$subtopicNodes"/>
  66. </tocitem>
  67. </xsl:when>
  68. <xsl:otherwise>
  69. <xsl:apply-templates select="$subtopicNodes"/>
  70. </xsl:otherwise>
  71. </xsl:choose>
  72. </xsl:template>
  73. <!-- do nothing when meeting with reltable -->
  74. <xsl:template match="*[contains(@class,' map/reltable ')]"/>
  75. </xsl:stylesheet>