lfs-mixed.xsl 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?xml version='1.0' encoding='ISO-8859-1'?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns="http://www.w3.org/1999/xhtml"
  4. version="1.0">
  5. <!-- screen -->
  6. <xsl:template match="screen">
  7. <xsl:choose>
  8. <!-- Temporally hack -->
  9. <xsl:when test="child::* = userinput">
  10. <pre class="{name(.)}">
  11. <kbd class="command">
  12. <xsl:value-of select="."/>
  13. </kbd>
  14. </pre>
  15. </xsl:when>
  16. <xsl:otherwise>
  17. <pre class="{name(.)}">
  18. <xsl:apply-templates/>
  19. </pre>
  20. </xsl:otherwise>
  21. </xsl:choose>
  22. </xsl:template>
  23. <!-- variablelist -->
  24. <xsl:template match="variablelist">
  25. <div class="{name(.)}">
  26. <xsl:if test="title">
  27. <xsl:choose>
  28. <xsl:when test="@role = 'materials'">
  29. <h2>
  30. <xsl:value-of select="title"/>
  31. </h2>
  32. </xsl:when>
  33. <xsl:otherwise>
  34. <h3>
  35. <xsl:value-of select="title"/>
  36. </h3>
  37. </xsl:otherwise>
  38. </xsl:choose>
  39. </xsl:if>
  40. <dl>
  41. <xsl:if test="@role">
  42. <xsl:attribute name="class">
  43. <xsl:value-of select="@role"/>
  44. </xsl:attribute>
  45. </xsl:if>
  46. <xsl:apply-templates select="varlistentry"/>
  47. </dl>
  48. </div>
  49. </xsl:template>
  50. <!-- Body attributes -->
  51. <xsl:template name="body.attributes">
  52. <xsl:attribute name="id">
  53. <xsl:text>lfs</xsl:text>
  54. </xsl:attribute>
  55. <xsl:attribute name="class">
  56. <xsl:value-of select="substring-after(/book/bookinfo/subtitle, ' ')"/>
  57. </xsl:attribute>
  58. </xsl:template>
  59. <!-- Sect1 attributes -->
  60. <xsl:template match="sect1">
  61. <div>
  62. <xsl:choose>
  63. <xsl:when test="@role">
  64. <xsl:attribute name="class">
  65. <xsl:value-of select="@role"/>
  66. </xsl:attribute>
  67. </xsl:when>
  68. <xsl:otherwise>
  69. <xsl:attribute name="class">
  70. <xsl:value-of select="name(.)"/>
  71. </xsl:attribute>
  72. </xsl:otherwise>
  73. </xsl:choose>
  74. <xsl:call-template name="language.attribute"/>
  75. <xsl:call-template name="sect1.titlepage"/>
  76. <xsl:apply-templates/>
  77. <xsl:call-template name="process.chunk.footnotes"/>
  78. </div>
  79. </xsl:template>
  80. <!-- Sect2 attributes -->
  81. <xsl:template match="sect2">
  82. <div>
  83. <xsl:choose>
  84. <xsl:when test="@role">
  85. <xsl:attribute name="class">
  86. <xsl:value-of select="@role"/>
  87. </xsl:attribute>
  88. </xsl:when>
  89. <xsl:otherwise>
  90. <xsl:attribute name="class">
  91. <xsl:value-of select="name(.)"/>
  92. </xsl:attribute>
  93. </xsl:otherwise>
  94. </xsl:choose>
  95. <xsl:call-template name="language.attribute"/>
  96. <xsl:call-template name="sect2.titlepage"/>
  97. <xsl:apply-templates/>
  98. <xsl:call-template name="process.chunk.footnotes"/>
  99. </div>
  100. </xsl:template>
  101. </xsl:stylesheet>