odmlTerms.xsl 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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. <!-- Check if there are any properties -->
  123. <xsl:if test="property">
  124. <table border="1" rules="rows" width="100%"><font size="-1">
  125. <tr bgcolor="#336699" align="left" valign="middle">
  126. <th><font size="+1" color="white"><b>Name</b></font></th>
  127. <th><font size="+1" color="white"><b>Value</b></font></th>
  128. <th><font size="+1" color="white"><b>Unit</b></font></th>
  129. <th><font size="+1" color="white"><b>Type</b></font></th>
  130. <th><font size="+1" color="white"><b>Definition</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%"><p><xsl:value-of select="value"/></p></td>
  143. <td width="5%"><p><xsl:value-of select="unit"/><br/></p></td>
  144. <td width="5%"><p><xsl:value-of select="type"/></p></td>
  145. <td width="22.5%"><p><xsl:value-of select="definition"/></p></td>
  146. <td width="5%"><p><xsl:value-of select="dependency"/></p></td>
  147. <td width="5%"><p><xsl:value-of select="dependencyValue"/></p></td>
  148. </tr>
  149. </xsl:for-each></font>
  150. </table>
  151. </xsl:if>
  152. <a href="#top"><tiny>top</tiny></a>
  153. <hr style="background-color:#336699; height:1px; margin-right:0; text-align:right;"/>
  154. <!-- recursive call if there are subsections -->
  155. <xsl:if test="section">
  156. <xsl:for-each select="section">
  157. <xsl:call-template name="sectionTemplate">
  158. <xsl:with-param name="navigation" select="$navigation"/>
  159. <xsl:with-param name="anchorBase" select="concat($anchorName,'SubSec')"/>
  160. <xsl:with-param name="url" select="$repository"/>
  161. </xsl:call-template>
  162. </xsl:for-each>
  163. </xsl:if>
  164. </xsl:otherwise>
  165. </xsl:choose>
  166. </xsl:template>
  167. </xsl:stylesheet>