mavlink.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. // Requires the installation of php5-xsl
  3. // e.g. on Debian/Ubuntu: sudo apt-get install php5-xsl
  4. // Load the file from the repository / server.
  5. // Update this URL if the file location changes
  6. $xml_file_name = "https://raw.github.com/mavlink/mavlink/master/message_definitions/v1.0/common.xml";
  7. // Load the XSL transformation file from the repository / server.
  8. // This file can be updated by any client to adjust the table
  9. $xsl_file_name= "https://raw.github.com/mavlink/mavlink/master/doc/mavlink_to_html_table.xsl";
  10. // Load data XML file
  11. $xml = file_get_contents($xml_file_name);
  12. $xml_doc = new DomDocument;
  13. $xml_doc->loadXML($xml);
  14. // Load stylesheet XSL file
  15. $xsl = file_get_contents($xsl_file_name);
  16. $xsl_doc = new DomDocument;
  17. $xsl_doc->loadXML($xsl);
  18. $xsltproc = new XsltProcessor();
  19. $xsltproc->importStylesheet($xsl_doc);
  20. ?>
  21. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
  22. <html>
  23. <head>
  24. <title>MAVLINK Common Message set specifications</title>
  25. <link rel="stylesheet" type="text/css" href="mavlink.css">
  26. </head>
  27. <body>
  28. <h1>MAVLINK Common Message Set</h1>
  29. <p>
  30. These messages define the common message set, which is the reference message set implemented by most ground control stations and autopilots.
  31. </p>
  32. <?php
  33. // process the files and write the output to $out_file
  34. if ($html = $xsltproc->transformToXML($xml_doc))
  35. {
  36. echo $html;
  37. }
  38. else
  39. {
  40. trigger_error("XSL transformation failed",E_USER_ERROR);
  41. }
  42. ?>
  43. <br />
  44. <br />
  45. <p>
  46. Messages are defined by the <a href="https://raw.github.com/mavlink/mavlink/master/message_definitions/v1.0/common.xml">common.xml</a> file. The C packing/unpacking code is generated from this specification, as well as the HTML documentaiton in the section above.<br />
  47. <br />
  48. <i>The XML displayed here is updated on every commit and therefore up-to-date.</i>
  49. </p>
  50. </body>
  51. </html>
  52. <?php
  53. //require_once("inc/geshi.php");
  54. //$xml_file_name = "http://github.com/pixhawk/mavlink/raw/master/mavlink_standard_message.xml";
  55. //
  56. //// Load data XML file
  57. //$xml = file_get_contents($xml_file_name);
  58. //
  59. //// Show the current code
  60. //$geshi_xml = new GeSHi($xml, 'xml');
  61. //$display_xml = $geshi_xml->parse_code();
  62. //
  63. //echo $display_xml;
  64. ?>