odmlTerms.xsl 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
  4. <!-- This stylesheet is for viewing odml-terminologies in a web browser -->
  5. <!-- Please note: only those elements will be displayed terminology related -->
  6. <!-- e.g. uncertainty, id, and valueComments will not be shown -->
  7. <!-- For viewing real metadata files use the odml.xsl stylesheet -->
  8. <!-- ************************************************ -->
  9. <!-- root template -->
  10. <xsl:template match="odML">
  11. <!-- if there is a base url definition read it and later pass it to the sections template -->
  12. <xsl:variable name="repository" select="repository"/>
  13. <html>
  14. <link href="../../../images/odMLIcon.ico" rel="shortcut icon"
  15. csoptsettings="AQAAAD142mNgYNBomeIwObe4IIeBgYEvyTDuaAoPw3IFiwOcndS8HR1NjO0NDPTNdIzzEzOByni+A8EQNoAAPMPEQ4="
  16. livesrc="../../../images/odMLIcon.png" />
  17. <style type="text/css">
  18. body { margin-left:2%; margin-top:10px; padding:0;} div { border:0px solid #888; }
  19. #navigationContainer { left:20px; width:80%;}
  20. #contentContainer { left:20px; width:80%;}
  21. </style>
  22. <body>
  23. <a name="top" style="color:#336699"><h1>odML - Metadata</h1></a>
  24. <div id="navigationContainer">
  25. <p>
  26. <hr style="color:yellow; background-color:#336699; height:4px; margin-right:0; text-align:right; border:1px dashed black;"/>
  27. <h2>Document info</h2>
  28. <b>Author: </b><xsl:if test="author"><xsl:value-of select="author"/></xsl:if><br/>
  29. <b>Date: </b><xsl:if test="date"><xsl:value-of select="date"/></xsl:if><br/>
  30. <b>Version: </b><xsl:if test="version"><xsl:value-of select="version"/></xsl:if><br/>
  31. <b>Repository: </b><xsl:if test="repository"><xsl:value-of select="repository"/></xsl:if><br/>
  32. </p>
  33. <hr style="color:yellow; background-color:#336699; height:4px; margin-right:0; text-align:right; border:1px dashed black;"/>
  34. <h2>Structure</h2>
  35. <font size ="-1" >
  36. <xsl:if test="section">
  37. <xsl:for-each select="section">
  38. <li>
  39. <xsl:call-template name="sectionTemplate">
  40. <xsl:with-param name="navigation">1</xsl:with-param>
  41. <xsl:with-param name="anchorBase">Sec</xsl:with-param>
  42. <xsl:with-param name="url" select="$repository"/>
  43. </xsl:call-template>
  44. </li>
  45. </xsl:for-each>
  46. </xsl:if>
  47. </font>
  48. </div>
  49. <div id="contentContainer">
  50. <hr style="color:yellow; background-color:#336699; height:4px; margin-right:0; text-align:right; border:1px dashed black;"/>
  51. <h2>Content</h2>
  52. <!-- apply the section template -->
  53. <xsl:if test="section">
  54. <xsl:for-each select="section">
  55. <xsl:call-template name="sectionTemplate">
  56. <xsl:with-param name="navigation">0</xsl:with-param>
  57. <xsl:with-param name="anchorBase">Sec</xsl:with-param>
  58. <xsl:with-param name="url" select="$repository"/>
  59. </xsl:call-template>
  60. </xsl:for-each>
  61. </xsl:if>
  62. </div>
  63. </body>
  64. </html>
  65. </xsl:template>
  66. <!-- ************************************************ -->
  67. <!-- section template. -->
  68. <xsl:template name="sectionTemplate" match="section">
  69. <xsl:param name="navigation"/>
  70. <xsl:param name="anchorBase"/>
  71. <xsl:param name="url"/>
  72. <xsl:variable name="anchorName" select="concat($anchorBase,position())"/>
  73. <!-- set new repository if specified within this section otherwise use the old one -->
  74. <xsl:variable name="repository">
  75. <xsl:choose>
  76. <xsl:when test="repository">
  77. <xsl:value-of select ="repository"/>
  78. </xsl:when>
  79. <xsl:otherwise>
  80. <xsl:value-of select ="$url"/>
  81. </xsl:otherwise>
  82. </xsl:choose>
  83. </xsl:variable>
  84. <!-- print out the content -->
  85. <xsl:choose>
  86. <!-- fill the navigation container if this is the task (navigation param = 1) -->
  87. <xsl:when test="$navigation = 1">
  88. <!-- create a link to the anchor in the content container -->
  89. <ol style="compact">
  90. <font size="normal"><a href="#{$anchorName}">
  91. <xsl:value-of select="name"/> (type: <xsl:value-of select="type"/>)
  92. </a></font>
  93. <!-- recursive call if there are subsections -->
  94. <xsl:if test="section">
  95. <xsl:for-each select="section">
  96. <xsl:call-template name="sectionTemplate">
  97. <xsl:with-param name="navigation" select="$navigation"/>
  98. <xsl:with-param name="anchorBase" select="concat($anchorName,'SubSec')"/>
  99. <xsl:with-param name="url" select="$repository"/>
  100. </xsl:call-template>
  101. </xsl:for-each>
  102. </xsl:if>
  103. </ol>
  104. </xsl:when>
  105. <!-- otherwise use template to display the content (navigation !=1) -->
  106. <xsl:otherwise>
  107. <a name="{$anchorName}"><h3> <xsl:value-of select="name"/> Section</h3></a>
  108. <p>
  109. <b>Type: </b><xsl:value-of select="type"/><br/>
  110. <xsl:choose>
  111. <xsl:when test ="repository">
  112. <b>Repository: </b><xsl:value-of select="repository"/><br/>
  113. </xsl:when>
  114. <xsl:otherwise>
  115. <b>Repository: </b><xsl:value-of select="$repository"/><br/>
  116. </xsl:otherwise>
  117. </xsl:choose>
  118. <b>Link: </b><xsl:if test="link"><xsl:value-of select="link"/></xsl:if><br/>
  119. <b>Include:</b> <xsl:if test="include"><font color="red"><xsl:value-of select="include"/></font></xsl:if><br/>
  120. <b>Definition: </b><xsl:if test="definition"><xsl:value-of select="definition"/></xsl:if><br/>
  121. </p>
  122. <b>Mapping: </b> <xsl:if test="mapping"><xsl:value-of select="mapping"/></xsl:if><br/>
  123. <!-- Check if there are any properties -->
  124. <xsl:if test="property">
  125. <table border="1" rules="rows" width="100%"><font size="-1">
  126. <tr bgcolor="#336699">
  127. <th><font size="+1" color="white"><b>Name</b></font></th>
  128. <th><font size="+1" color="white"><b>Value</b></font></th>
  129. <th><font size="+1" color="white"><b>Unit</b></font></th>
  130. <th><font size="+1" color="white"><b>Type</b></font></th>
  131. <th><font size="+1" color="white"><b>Definition</b></font></th>
  132. <th><font size="+1" color="white"><b>Mapping</b></font></th>
  133. <th><font size="+1" color="white"><b>Dependency</b></font></th>
  134. <th><font size="+1" color="white"><b>Dependency Value</b></font></th>
  135. </tr>
  136. <xsl:for-each select="property">
  137. <xsl:variable name="anchor">
  138. <xsl:value-of select ="name"/>
  139. </xsl:variable>
  140. <tr>
  141. <td width="15%"><a name="{$anchor}"/>
  142. <p><xsl:value-of select="name"/></p>
  143. </td>
  144. <td width="10%">
  145. <xsl:for-each select="value">
  146. <p><xsl:value-of select="text()"/><br/></p>
  147. </xsl:for-each>
  148. </td>
  149. <td width="5%">
  150. <xsl:for-each select="value">
  151. <p><xsl:value-of select="unit"/><br/></p>
  152. </xsl:for-each>
  153. </td>
  154. <td width="5%">
  155. <xsl:for-each select="value">
  156. <p><xsl:value-of select="type"/><br/></p>
  157. </xsl:for-each>
  158. </td>
  159. <td width="22.5%"><p><xsl:value-of select="definition"/></p></td>
  160. <td width="10%">
  161. <p>
  162. <xsl:for-each select="mapping">
  163. <xsl:variable name="mapping" select="."/>
  164. <p><a href="{$mapping}"><small><xsl:value-of select="."/></small></a></p>
  165. </xsl:for-each>
  166. </p>
  167. </td>
  168. <td width="5%"><p><xsl:value-of select="dependency"/></p></td>
  169. <td width="5%"><p><xsl:value-of select="dependencyValue"/></p></td>
  170. </tr>
  171. </xsl:for-each></font>
  172. </table>
  173. </xsl:if>
  174. <a href="#top"><tiny>top</tiny></a>
  175. <hr style="background-color:#336699; height:1px; margin-right:0; text-align:right;"/>
  176. <!-- recursive call if there are subsections -->
  177. <xsl:if test="section">
  178. <xsl:for-each select="section">
  179. <xsl:call-template name="sectionTemplate">
  180. <xsl:with-param name="navigation" select="$navigation"/>
  181. <xsl:with-param name="anchorBase" select="concat($anchorName,'SubSec')"/>
  182. <xsl:with-param name="url" select="$repository"/>
  183. </xsl:call-template>
  184. </xsl:for-each>
  185. </xsl:if>
  186. </xsl:otherwise>
  187. </xsl:choose>
  188. </xsl:template>
  189. </xsl:stylesheet>