doap2html.xsl 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Turn DOAP rdf into html.
  4. Copyright (c) 2013-2021 Marcus Rohrmoser mobile Software http://mro.name/~me. All rights reserved.
  5. Redistribution and use in source and binary forms, with or without modification, are permitted
  6. provided that the following conditions are met:
  7. 1. Redistributions of source code must retain the above copyright notice, this list of conditions
  8. and the following disclaimer.
  9. 2. The software must not be used for military or intelligence or related purposes nor
  10. anything that's in conflict with human rights as declared in http://www.un.org/en/documents/udhr/ .
  11. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  12. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  13. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
  14. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  15. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  16. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  17. IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  18. THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  19. http://www.w3.org/TR/xslt
  20. http://www.w3.org/TR/xpath/
  21. -->
  22. <xsl:stylesheet
  23. xmlns:dct="http://purl.org/dc/terms/"
  24. xmlns:doap="http://usefulinc.com/ns/doap#"
  25. xmlns:foaf="http://xmlns.com/foaf/0.1/"
  26. xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  27. xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
  28. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  29. xmlns="http://www.w3.org/1999/xhtml"
  30. xmlns:date="http://exslt.org/date"
  31. version="1.0">
  32. <xsl:output
  33. method="html"
  34. doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
  35. doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>
  36. <xsl:variable name="base_url" select="/*/@xml:base"/>
  37. <xsl:template match="/rdf:RDF">
  38. <xsl:apply-templates select="doap:Project[1]"/>
  39. </xsl:template>
  40. <xsl:template match="doap:Project">
  41. <html xmlns="http://www.w3.org/1999/xhtml">
  42. <head>
  43. <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
  44. <link href="./doap2html.css" rel="stylesheet" type="text/css"/>
  45. <title><xsl:value-of select="doap:name"/> – DOAP</title>
  46. </head>
  47. <body>
  48. <div id="name">
  49. <h1><xsl:value-of select="doap:name"/><xsl:text> </xsl:text><a href="#name">¶</a></h1>
  50. </div>
  51. <div id="shortdesc">
  52. <xsl:for-each select="doap:shortdesc">
  53. <p xml:lang="{@xml:lang}" lang="{@xml:lang}">
  54. <em><xsl:value-of select="."/></em>
  55. <!-- sup><a href="http://lexvo.org/id/iso639-1/{@xml:lang}"><xsl:value-of select="@xml:lang"/></a></sup -->
  56. </p>
  57. </xsl:for-each>
  58. </div>
  59. <div id="description">
  60. <xsl:for-each select="doap:description">
  61. <p xml:lang="{@xml:lang}" lang="{@xml:lang}">
  62. <xsl:value-of select="."/>
  63. <!-- sup><a href="http://lexvo.org/id/iso639-1/{@xml:lang}"><xsl:value-of select="@xml:lang"/></a></sup -->
  64. </p>
  65. </xsl:for-each>
  66. </div>
  67. <ul>
  68. <xsl:for-each select="doap:readme">
  69. <li class="readme"><a href="{@rdf:resource}">Readme</a></li>
  70. </xsl:for-each>
  71. <xsl:for-each select="doap:homepage">
  72. <li class="homepage"><a href="{@rdf:resource}">Homepage</a></li>
  73. </xsl:for-each>
  74. <xsl:for-each select="doap:mailing-list">
  75. <li class="mailing-list"><a href="{@rdf:resource}">Mailing List</a></li>
  76. </xsl:for-each>
  77. <xsl:for-each select="doap:bug-database">
  78. <li class="bug-database"><a href="{@rdf:resource}">Bug Database</a></li>
  79. </xsl:for-each>
  80. <xsl:for-each select="doap:wiki">
  81. <li class="wiki"><a href="{@rdf:resource}">Wiki</a></li>
  82. </xsl:for-each>
  83. <xsl:for-each select="doap:license">
  84. <li class="license"><a href="{@rdf:resource}">License</a></li>
  85. </xsl:for-each>
  86. <xsl:for-each select="doap:service-endpoint">
  87. <li class="service-endpoint"><a href="{@rdf:resource}">Service Endpoint</a></li>
  88. </xsl:for-each>
  89. </ul>
  90. <div id="implements">
  91. <h2>Implements <a href="#implements">¶</a></h2>
  92. <ul>
  93. <xsl:for-each select="doap:implements">
  94. <li class="implements">
  95. <a href="{@rdf:resource}"><xsl:value-of select="@rdf:resource"/></a>
  96. </li>
  97. </xsl:for-each>
  98. </ul>
  99. </div>
  100. <div id="programming-language">
  101. <h2>Programming Language <a href="#programming-language">¶</a></h2>
  102. <p>
  103. <xsl:for-each select="doap:programming-language">
  104. <span><xsl:value-of select="."/></span>,
  105. </xsl:for-each>
  106. </p>
  107. </div>
  108. <div id="repositories">
  109. <h2>Repositories <a href="#repositories">¶</a></h2>
  110. <ul>
  111. <xsl:for-each select="doap:repository/*[doap:location]/doap:browse">
  112. <li>
  113. <a href="{@rdf:resource}"><xsl:value-of select="@rdf:resource"/></a>
  114. </li>
  115. </xsl:for-each>
  116. <xsl:for-each select="doap:repository/*[not(doap:location)]/doap:browse">
  117. <li>
  118. <a href="{@rdf:resource}"><xsl:value-of select="@rdf:resource"/></a>
  119. </li>
  120. </xsl:for-each>
  121. </ul>
  122. </div>
  123. <p id="sep">* * *</p>
  124. <p id="poweredby">RDF (<a href="https://en.wikipedia.org/wiki/DOAP">DOAP</a>): <tt>$ <a href=
  125. "http://librdf.org/raptor/rapper.html">rapper</a> --guess --output turtle '<span id=
  126. "my-url">https://example.com/url-to-here</span>'</tt></p><script src="./doap2html.js" type="text/javascript">
  127. </script>
  128. </body>
  129. </html>
  130. </xsl:template>
  131. </xsl:stylesheet>