Newer
Older
XML / modules / basic-text-formatting.xml
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <!--
  4. Basic text formatting, like emphasis, bold, etc.
  5. -->
  6.  
  7. <stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  8.  
  9.  
  10. <!-- "Logical" styles. -->
  11.  
  12. <!-- Emphasis (normally italic). -->
  13. <template name="emph" match="emph|em">
  14. <common formats="/latex/xelatex/">
  15. <xsl:text>\emph{</xsl:text>
  16. <xsl:apply-templates />
  17. <xsl:text>}</xsl:text>
  18. </common>
  19. <common formats="/html/xhtml/">
  20. <em><xsl:apply-templates /></em>
  21. </common>
  22. </template>
  23.  
  24. <!--
  25. Emphasis inside answers needs to be handled specially in HTML, as it doesn't just flip-flop automatically like it does in LaTeX.
  26. -->
  27. <template name="emph-in-answer" match="answer//emph|answer//em">
  28. <common formats="/latex/xelatex/">
  29. <xsl:text>\emph{</xsl:text>
  30. <xsl:apply-templates />
  31. <xsl:text>}</xsl:text>
  32. </common>
  33. <common formats="/html/xhtml/">
  34. <strong><xsl:apply-templates /></strong>
  35. </common>
  36. </template>
  37.  
  38. <!-- Strong emphasis (normally bold). -->
  39. <template name="strong" match="strong">
  40. <common formats="/latex/xelatex/">
  41. <xsl:text>\textbf{</xsl:text>
  42. <xsl:apply-templates />
  43. <xsl:text>}</xsl:text>
  44. </common>
  45. <common formats="/html/xhtml/">
  46. <strong><xsl:apply-templates /></strong>
  47. </common>
  48. </template>
  49. <!-- A defined term. -->
  50. <template name="term" match="term">
  51. <common formats="/latex/xelatex/">
  52. <xsl:text>\term{</xsl:text>
  53. <xsl:apply-templates />
  54. <xsl:text>}</xsl:text>
  55. </common>
  56. <common formats="/html/xhtml/">
  57. <i class="term"><xsl:apply-templates /></i>
  58. </common>
  59. </template>
  60. <!-- A foreign word or phrase. -->
  61. <template name="foreign" match="foreign">
  62. <common formats="/latex/xelatex/">
  63. <xsl:text>\foreign{</xsl:text>
  64. <xsl:apply-templates />
  65. <xsl:text>}</xsl:text>
  66. </common>
  67. <common formats="/html/xhtml/">
  68. <i class="foreign"><xsl:apply-templates /></i>
  69. </common>
  70. </template>
  71.  
  72. <!-- "Physical" styles. -->
  73. <!-- Italics. -->
  74. <template name="italic" match="italic">
  75. <common formats="/latex/xelatex/">
  76. <xsl:text>\textit{</xsl:text>
  77. <xsl:apply-templates />
  78. <xsl:text>}</xsl:text>
  79. </common>
  80. <common formats="/html/xhtml/">
  81. <i><xsl:apply-templates /></i>
  82. </common>
  83. </template>
  84. <!-- Bold face. -->
  85. <template name="bold" match="bold">
  86. <common formats="/latex/xelatex/">
  87. <xsl:text>\textbf{</xsl:text>
  88. <xsl:apply-templates />
  89. <xsl:text>}</xsl:text>
  90. </common>
  91. <common formats="/html/xhtml/">
  92. <b><xsl:apply-templates /></b>
  93. </common>
  94. </template>
  95. <!-- Underlining. -->
  96. <template name="underline" match="underline|u">
  97. <common formats="/latex/xelatex/">
  98. <xsl:text>\uline{</xsl:text>
  99. <xsl:apply-templates />
  100. <xsl:text>}</xsl:text>
  101. </common>
  102. <common formats="/html/xhtml/">
  103. <span style="text-decoration: underline;"><xsl:apply-templates /></span>
  104. </common>
  105. </template>
  106. <!-- Strike-through. -->
  107. <template name="strike-through" match="strike-through|line-through|strikethrough|linethrough">
  108. <common formats="/latex/xelatex/">
  109. <xsl:text>\sout{</xsl:text>
  110. <xsl:apply-templates />
  111. <xsl:text>}</xsl:text>
  112. </common>
  113. <common formats="/html/xhtml/">
  114. <span style="text-decoration: line-through;"><xsl:apply-templates /></span>
  115. </common>
  116. </template>
  117. <!-- Center stuff on the page. -->
  118. <template name="center" match="center|centering|centre|centring">
  119. <common formats="/latex/xelatex/">
  120. <xsl:text>\begin{center}</xsl:text>
  121. <xsl:call-template name="newline-internal" />
  122. <xsl:apply-templates />
  123. <xsl:text>\end{center}</xsl:text>
  124. <xsl:call-template name="newline-internal" />
  125. </common>
  126. <common formats="/html/xhtml/">
  127. <div style="text-align: center;">
  128. <xsl:apply-templates />
  129. </div>
  130. </common>
  131. </template>
  132. </stylesheet>