lfs-mixed.xsl 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. <xsl:apply-templates/>
  11. </pre>
  12. </xsl:when>
  13. <xsl:otherwise>
  14. <pre class="{name(.)}">
  15. <xsl:apply-templates/>
  16. </pre>
  17. </xsl:otherwise>
  18. </xsl:choose>
  19. </xsl:template>
  20. <xsl:template match="userinput">
  21. <xsl:choose>
  22. <xsl:when test="ancestor::screen">
  23. <kbd class="command">
  24. <xsl:apply-templates/>
  25. </kbd>
  26. </xsl:when>
  27. <xsl:otherwise>
  28. <xsl:apply-imports/>
  29. </xsl:otherwise>
  30. </xsl:choose>
  31. </xsl:template>
  32. <!-- variablelist -->
  33. <xsl:template match="variablelist">
  34. <div class="{name(.)}">
  35. <xsl:if test="title | bridgehead">
  36. <xsl:choose>
  37. <xsl:when test="@role = 'materials'">
  38. <h2>
  39. <xsl:value-of select="title | bridgehead"/>
  40. </h2>
  41. </xsl:when>
  42. <xsl:otherwise>
  43. <h3>
  44. <xsl:value-of select="title | bridgehead"/>
  45. </h3>
  46. </xsl:otherwise>
  47. </xsl:choose>
  48. </xsl:if>
  49. <dl>
  50. <xsl:if test="@role">
  51. <xsl:attribute name="class">
  52. <xsl:value-of select="@role"/>
  53. </xsl:attribute>
  54. </xsl:if>
  55. <xsl:apply-templates select="varlistentry"/>
  56. </dl>
  57. </div>
  58. </xsl:template>
  59. <!-- Body attributes -->
  60. <xsl:template name="body.attributes">
  61. <xsl:attribute name="id">
  62. <xsl:text>lfs</xsl:text>
  63. </xsl:attribute>
  64. <xsl:attribute name="class">
  65. <xsl:value-of select="substring-after(/book/bookinfo/subtitle, ' ')"/>
  66. </xsl:attribute>
  67. </xsl:template>
  68. <!-- External URLs in italic font -->
  69. <xsl:template match="ulink" name="ulink">
  70. <a>
  71. <xsl:if test="@id">
  72. <xsl:attribute name="id">
  73. <xsl:value-of select="@id"/>
  74. </xsl:attribute>
  75. </xsl:if>
  76. <xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>
  77. <i>
  78. <xsl:choose>
  79. <xsl:when test="count(child::node())=0">
  80. <xsl:value-of select="@url"/>
  81. </xsl:when>
  82. <xsl:otherwise>
  83. <xsl:apply-templates/>
  84. </xsl:otherwise>
  85. </xsl:choose>
  86. </i>
  87. </a>
  88. </xsl:template>
  89. </xsl:stylesheet>