step1-task.xsl 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?xml version="1.0"?>
  2. <!--
  3. This file is part of the DITA Open Toolkit project.
  4. Copyright 2004, 2006 IBM Corporation
  5. See the accompanying LICENSE file for applicable license.
  6. -->
  7. <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  8. <xsl:output method="xml"/>
  9. <xsl:template match="*[contains(@class,' task/steps ') or contains(@class,' task/steps-unordered ')]" name="topic.task.steps">
  10. <xsl:choose>
  11. <xsl:when test="not(*[2])">
  12. <block><xsl:call-template name="commonatts"/><xsl:apply-templates/></block>
  13. </xsl:when>
  14. <xsl:otherwise>
  15. <xsl:apply-imports/>
  16. </xsl:otherwise>
  17. </xsl:choose>
  18. </xsl:template>
  19. <xsl:template match="*[contains(@class,' task/step ')]/@importance |
  20. *[contains(@class,' task/substep ')]/@importance">
  21. <xsl:if test=".='optional' or .='required'">
  22. <text style="bold"><xsl:call-template name="commonatts"/>
  23. <xsl:if test=".='optional'">
  24. <xsl:call-template name="getVariable"><xsl:with-param name="id" select="'Optional'"/></xsl:call-template>
  25. </xsl:if>
  26. <xsl:if test=".='required'">
  27. <xsl:call-template name="getVariable"><xsl:with-param name="id" select="'Required'"/></xsl:call-template>
  28. </xsl:if>
  29. <xsl:call-template name="getVariable"><xsl:with-param name="id" select="'ColonSymbol'"/></xsl:call-template>
  30. </text>
  31. <xsl:text> </xsl:text>
  32. </xsl:if>
  33. </xsl:template>
  34. <xsl:template match="*[contains(@class,' task/step ')]">
  35. <xsl:choose>
  36. <xsl:when test="following-sibling::*|preceding-sibling::*">
  37. <xsl:variable name="listintro">
  38. <xsl:choose>
  39. <xsl:when test="parent::*[contains(@class,' task/steps-unordered ')]">* </xsl:when>
  40. <xsl:otherwise>
  41. <xsl:apply-templates select="." mode="get-list-number"/><xsl:text> </xsl:text>
  42. </xsl:otherwise>
  43. </xsl:choose>
  44. </xsl:variable>
  45. <block leadin="{$listintro}" indent="{string-length($listintro)}">
  46. <xsl:call-template name="commonatts"/>
  47. <xsl:if test="parent::*[@compact='yes']">
  48. <xsl:attribute name="compact">yes</xsl:attribute>
  49. </xsl:if>
  50. <xsl:apply-templates select="@importance"/>
  51. <xsl:apply-templates/>
  52. </block>
  53. </xsl:when>
  54. <xsl:otherwise>
  55. <xsl:apply-templates select="@importance"/>
  56. <xsl:apply-templates/>
  57. </xsl:otherwise>
  58. </xsl:choose>
  59. </xsl:template>
  60. <xsl:template match="*[contains(@class,' task/substep ')]">
  61. <xsl:variable name="listintro">
  62. <xsl:apply-templates select="." mode="get-list-number"/><xsl:text> </xsl:text>
  63. </xsl:variable>
  64. <block leadin="{$listintro}" indent="{string-length($listintro)}">
  65. <xsl:call-template name="commonatts"/>
  66. <xsl:if test="parent::*[@compact='yes']"><xsl:attribute name="compact">yes</xsl:attribute></xsl:if>
  67. <xsl:apply-templates select="@importance"/>
  68. <xsl:apply-templates/>
  69. </block>
  70. </xsl:template>
  71. <xsl:template match="*[contains(@class,' task/choicetable ')]" mode="default-simpletable-headers">
  72. <xsl:value-of select="$newline"/>
  73. <thead><xsl:call-template name="commonatts"/>
  74. <row><xsl:call-template name="commonatts"/>
  75. <xsl:value-of select="$newline"/>
  76. <entry><xsl:call-template name="commonatts"/>
  77. <xsl:call-template name="getVariable">
  78. <xsl:with-param name="id" select="'Option'"/>
  79. </xsl:call-template>
  80. </entry>
  81. <xsl:value-of select="$newline"/>
  82. <entry><xsl:call-template name="commonatts"/>
  83. <xsl:call-template name="getVariable">
  84. <xsl:with-param name="id" select="'Description'"/>
  85. </xsl:call-template>
  86. </entry>
  87. </row>
  88. </thead>
  89. </xsl:template>
  90. </xsl:stylesheet>