odmlTerms.xsl 9.3 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" 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. <xsl:choose>
  106. <xsl:when test ="repository">
  107. <b>Repository: </b><xsl:value-of select="repository"/><br/>
  108. </xsl:when>
  109. <xsl:otherwise>
  110. <b>Repository: </b><xsl:value-of select="$repository"/><br/>
  111. </xsl:otherwise>
  112. </xsl:choose>
  113. <b>Link: </b><xsl:if test="link"><xsl:value-of select="link"/></xsl:if><br/>
  114. <b>Include:</b> <xsl:if test="include"><font color="red"><xsl:value-of select="include"/></font></xsl:if><br/>
  115. <b>Definition: </b><xsl:if test="definition"><xsl:value-of select="definition"/></xsl:if><br/>
  116. </p>
  117. <b>Mapping: </b> <xsl:if test="mapping"><xsl:value-of select="mapping"/></xsl:if><br/>
  118. <!-- Check if there are any properties -->
  119. <xsl:if test="property">
  120. <table border="1" rules="rows" width="100%"><font size="-1">
  121. <tr bgcolor="#336699">
  122. <th><font size="+1" color="white"><b>Name</b></font></th>
  123. <th><font size="+1" color="white"><b>Value</b></font></th>
  124. <th><font size="+1" color="white"><b>Unit</b></font></th>
  125. <th><font size="+1" color="white"><b>Type</b></font></th>
  126. <th><font size="+1" color="white"><b>Definition</b></font></th>
  127. <th><font size="+1" color="white"><b>Mapping</b></font></th>
  128. <th><font size="+1" color="white"><b>Dependency</b></font></th>
  129. <th><font size="+1" color="white"><b>Dependency Value</b></font></th>
  130. </tr>
  131. <xsl:for-each select="property">
  132. <xsl:variable name="anchor">
  133. <xsl:value-of select ="name"/>
  134. </xsl:variable>
  135. <tr>
  136. <td width="15%"><a name="{$anchor}"/>
  137. <p><xsl:value-of select="name"/></p>
  138. </td>
  139. <td width="10%">
  140. <xsl:for-each select="value">
  141. <p><xsl:value-of select="text()"/><br/></p>
  142. </xsl:for-each>
  143. </td>
  144. <td width="5%">
  145. <xsl:for-each select="value">
  146. <p><xsl:value-of select="unit"/><br/></p>
  147. </xsl:for-each>
  148. </td>
  149. <td width="5%">
  150. <xsl:for-each select="value">
  151. <p><xsl:value-of select="type"/><br/></p>
  152. </xsl:for-each>
  153. </td>
  154. <td width="22.5%"><p><xsl:value-of select="definition"/></p></td>
  155. <td width="10%">
  156. <p>
  157. <xsl:for-each select="mapping">
  158. <xsl:variable name="mapping" select="."/>
  159. <p><a href="{$mapping}"><small><xsl:value-of select="."/></small></a></p>
  160. </xsl:for-each>
  161. </p>
  162. </td>
  163. <td width="5%"><p><xsl:value-of select="dependency"/></p></td>
  164. <td width="5%"><p><xsl:value-of select="dependencyValue"/></p></td>
  165. </tr>
  166. </xsl:for-each></font>
  167. </table>
  168. </xsl:if>
  169. <a href="#top"><tiny>top</tiny></a>
  170. <hr style="background-color:#336699; height:1px; margin-right:0; text-align:right;"/>
  171. <!-- recursive call if there are subsections -->
  172. <xsl:if test="section">
  173. <xsl:for-each select="section">
  174. <xsl:call-template name="sectionTemplate">
  175. <xsl:with-param name="navigation" select="$navigation"/>
  176. <xsl:with-param name="anchorBase" select="concat($anchorName,'SubSec')"/>
  177. <xsl:with-param name="url" select="$repository"/>
  178. </xsl:call-template>
  179. </xsl:for-each>
  180. </xsl:if>
  181. </xsl:otherwise>
  182. </xsl:choose>
  183. </xsl:template>
  184. </xsl:stylesheet>