lfs-mixed.xsl 2.9 KB

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