mavlink_to_html_table_gitbook.xsl 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <?xml version="1.0"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3. <xsl:template match="//include">
  4. <p><strong>MAVLink Include Files: </strong> <a><xsl:attribute name="href"><xsl:value-of select="."/>.md.unlikely</xsl:attribute><xsl:value-of select="." /></a> </p>
  5. </xsl:template>
  6. <xsl:template match="//enums">
  7. <h2>MAVLink Type Enumerations</h2>
  8. <xsl:apply-templates select="enum[@name!='MAV_CMD']" />
  9. <h2>MAVLink Commands (MAV_CMD)</h2>
  10. <xsl:apply-templates select="enum[@name='MAV_CMD']" mode="params"/>
  11. </xsl:template>
  12. <xsl:template match="//messages">
  13. <h2>MAVLink Messages</h2>
  14. <xsl:apply-templates />
  15. </xsl:template>
  16. <xsl:template match="//message">
  17. <h3> <!-- mavlink_message_name -->
  18. <xsl:attribute name="id"><xsl:value-of select="@name"/></xsl:attribute>
  19. <xsl:value-of select="@name" /> (
  20. <a>
  21. <xsl:attribute name="href">#<xsl:value-of select="@name"/></xsl:attribute>
  22. #<xsl:value-of select="@id" />
  23. </a>
  24. )</h3>
  25. <xsl:apply-templates select="wip" />
  26. <xsl:apply-templates select="deprecated" />
  27. <p> <!-- description -->
  28. <xsl:if test='@id > 255'><strong>(MAVLink 2) </strong></xsl:if>
  29. <xsl:value-of select="description" /></p>
  30. <table class="sortable">
  31. <thead>
  32. <tr> <!-- mavlink_field_header -->
  33. <th>Field Name</th>
  34. <th>Type</th>
  35. <xsl:if test='*/@units'>
  36. <th>Units</th>
  37. </xsl:if>
  38. <xsl:if test='*/@enum'>
  39. <th>Values</th>
  40. </xsl:if>
  41. <th>Description</th>
  42. </tr>
  43. </thead>
  44. <tbody>
  45. <xsl:apply-templates select="field" />
  46. </tbody>
  47. </table>
  48. </xsl:template>
  49. <xsl:template match="//field">
  50. <tr> <!-- mavlink_field -->
  51. <xsl:choose>
  52. <xsl:when test="preceding-sibling::extensions">
  53. <td style="color:blue;"><xsl:value-of select="@name" />&#160;<a href="#mav2_extension_field" title="MAVLink2 extension field">**</a></td> <!-- mavlink_name -->
  54. </xsl:when>
  55. <xsl:otherwise>
  56. <td><xsl:value-of select="@name" /></td> <!-- mavlink_name -->
  57. </xsl:otherwise>
  58. </xsl:choose>
  59. <td><xsl:value-of select="@type" /></td> <!-- mavlink_type -->
  60. <xsl:if test='../*/@units'>
  61. <td><xsl:value-of select="@units" /></td> <!-- mavlink_units -->
  62. </xsl:if>
  63. <xsl:if test='../*/@enum'>
  64. <td>
  65. <a><xsl:attribute name="href">#<xsl:value-of select="@enum" /></xsl:attribute><xsl:value-of select="@enum" /></a>
  66. </td> <!-- mavlink_value -->
  67. </xsl:if>
  68. <td> <xsl:value-of select="." /> </td> <!-- mavlink_comment -->
  69. </tr>
  70. </xsl:template>
  71. <xsl:template match="//version">
  72. <h2>MAVLink Protocol Version</h2>
  73. <p>The current MAVLink version is 2.<xsl:value-of select="." />. The minor version numbers (after the dot) range from 1-255. </p>
  74. </xsl:template>
  75. <xsl:template match="//dialect">
  76. <p>This file has protocol dialect: <xsl:value-of select="." />.</p>
  77. </xsl:template>
  78. <xsl:template match="//enum">
  79. <h3> <!-- mavlink_message_name -->
  80. <xsl:attribute name="id"><xsl:value-of select="@name"/></xsl:attribute>
  81. <a><xsl:attribute name="href">#<xsl:value-of select="@name"/></xsl:attribute>
  82. <xsl:value-of select="@name" /></a></h3>
  83. <xsl:apply-templates select="deprecated" />
  84. <p><xsl:value-of select="description" /></p> <!-- description -->
  85. <table class="sortable">
  86. <thead>
  87. <tr> <!-- mavlink_field_header -->
  88. <th>Value</th>
  89. <th>Field Name</th>
  90. <th>Description</th>
  91. </tr>
  92. </thead>
  93. <tbody>
  94. <xsl:apply-templates select="entry" />
  95. </tbody>
  96. </table>
  97. </xsl:template>
  98. <xsl:template match="//enum" mode="params">
  99. <p><xsl:value-of select="description" /> </p>
  100. <xsl:apply-templates select="entry" mode="params" />
  101. </xsl:template>
  102. <xsl:template match="//entry" mode="params">
  103. <h3 id="{@name}"><xsl:value-of select="@name" /> (<a><xsl:attribute name="href">#<xsl:value-of select="@name"/></xsl:attribute><xsl:value-of select="@value" /></a>)</h3>
  104. <xsl:apply-templates select="deprecated" />
  105. <xsl:apply-templates select="wip" />
  106. <p><xsl:value-of select="description" /> </p> <!-- mavlink_comment -->
  107. <table class="sortable">
  108. <thead>
  109. <tr> <!-- mavlink_field_header -->
  110. <th>Param</th>
  111. <th>Description</th>
  112. <xsl:if test='*/@enum or */@minValue or */@maxValue or */@increment'>
  113. <th>Values</th>
  114. </xsl:if>
  115. <xsl:if test='*/@units'>
  116. <th>Units</th>
  117. </xsl:if>
  118. </tr>
  119. </thead>
  120. <tbody>
  121. <xsl:apply-templates select="param" mode="params" />
  122. </tbody>
  123. </table>
  124. </xsl:template>
  125. <xsl:template match="//entry">
  126. <tr id="{@name}"> <!-- mavlink_field -->
  127. <td><xsl:value-of select="@value" /></td> <!-- mavlink_type -->
  128. <td>
  129. <a><xsl:attribute name="href">#<xsl:value-of select="@name"/></xsl:attribute><xsl:value-of select="@name" /></a>
  130. <xsl:apply-templates select="deprecated" />
  131. <xsl:apply-templates select="wip" />
  132. </td> <!-- mavlink_name -->
  133. <td><xsl:value-of select="description" /></td> <!-- mavlink_comment -->
  134. </tr>
  135. <xsl:if test='param'>
  136. <tr>
  137. <td></td>
  138. <xsl:apply-templates select="param" />
  139. </tr>
  140. <tr>
  141. <td colspan="3"><br /></td>
  142. </tr>
  143. </xsl:if>
  144. </xsl:template>
  145. <xsl:template match="//param" mode="params">
  146. <tr>
  147. <td><xsl:value-of select="@index" /> </td> <!-- mission_param -->
  148. <td><xsl:value-of select="." />
  149. <xsl:if test='@label or @decimalPlaces'><br /><strong>GCS display settings:</strong>
  150. <xsl:if test='@label'><em>Label:</em> <xsl:value-of select="@label" />, </xsl:if>
  151. <xsl:if test='@decimalPlaces'><em>decimalPlaces:</em> <xsl:value-of select="@decimalPlaces" /></xsl:if>
  152. </xsl:if>
  153. </td>
  154. <xsl:if test='../*/@enum or ../*/@minValue or ../*/@maxValue or ../*/@increment'>
  155. <td>
  156. <xsl:choose>
  157. <xsl:when test="@enum">
  158. <xsl:value-of select="@enum" />
  159. </xsl:when>
  160. <xsl:when test="@minValue or @maxValue or @increment ">
  161. <xsl:if test='@minValue'><em>min:</em><xsl:value-of select="@minValue" /><xsl:text>xxx_space_xxx</xsl:text></xsl:if>
  162. <xsl:if test='@maxValue'><em>max:</em><xsl:value-of select="@maxValue" /><xsl:text>xxx_space_xxx</xsl:text></xsl:if>
  163. <xsl:if test='@increment'><em>increment:</em><xsl:value-of select="@increment" /></xsl:if>
  164. </xsl:when>
  165. </xsl:choose>
  166. </td>
  167. </xsl:if>
  168. <xsl:if test='../*/@units'>
  169. <td><xsl:value-of select="@units" /></td> <!-- mavlink_units -->
  170. </xsl:if>
  171. </tr>
  172. </xsl:template>
  173. <xsl:template match="//param">
  174. <tr>
  175. <td></td>
  176. <td>Param #<xsl:value-of select="@index" /></td> <!-- mission_param -->
  177. <td>
  178. <xsl:value-of select="." />
  179. <xsl:choose>
  180. <xsl:when test="@enum">
  181. <br /><strong>Possible values:</strong> <xsl:value-of select="@enum" />
  182. </xsl:when>
  183. <xsl:when test="@minValue or @maxValue or @increment or @units">
  184. <br /><strong>Values:</strong>
  185. <xsl:if test='@units'><em>units:</em> <xsl:value-of select="@minValue" />, </xsl:if>
  186. <xsl:if test='@minValue'><em>min:</em><xsl:value-of select="@minValue" />, </xsl:if>
  187. <xsl:if test='@maxValue'><em>max:</em><xsl:value-of select="@maxValue" />, </xsl:if>
  188. <xsl:if test='@increment'><em>increment:</em><xsl:value-of select="@increment" /></xsl:if>
  189. </xsl:when>
  190. </xsl:choose>
  191. <xsl:if test='@label or @decimalPlaces'><br /><strong>GCS display settings:</strong>
  192. <xsl:if test='@label'><em>Label:</em> <xsl:value-of select="@label" />, </xsl:if>
  193. <xsl:if test='@decimalPlaces'><em>decimalPlaces:</em> <xsl:value-of select="@decimalPlaces" /></xsl:if>
  194. </xsl:if>
  195. </td> <!-- mavlink_comment -->
  196. </tr>
  197. </xsl:template>
  198. <xsl:template match="//wip">
  199. <p style="color:red"><strong>WORK IN PROGRESS:</strong><xsl:text>xxx_space_xxx</xsl:text>Do not use in stable production environments (it may change).</p>
  200. </xsl:template>
  201. <xsl:template match="//deprecated">
  202. <p style="color:red"><strong>DEPRECATED:</strong><xsl:text>xxx_space_xxx</xsl:text>Replaced by <xsl:value-of select="@replaced_by" /> (<xsl:value-of select="@since" />).
  203. <xsl:if test='.'>
  204. <xsl:value-of select="." />
  205. </xsl:if>
  206. </p>
  207. </xsl:template>
  208. </xsl:stylesheet>