odmlTerms.xsl 9.3 KB

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