Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

242 lines
9.4 KiB

  1. <?xml version="1.0"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
  3. <!-- Root template selects all children of the CIM/DECLARATIONS tag -->
  4. <xsl:template match="/">
  5. <xsl:apply-templates select="CIM/DECLARATION/*"/>
  6. </xsl:template>
  7. <!-- Grab a DECLGROUP -->
  8. <xsl:template match="DECLGROUP">
  9. <xsl:apply-templates select="CLASS"/>
  10. <xsl:apply-templates select="ASSOCIATION.CLASS"/>
  11. <xsl:apply-templates select="INSTANCE"/>
  12. <xsl:apply-templates select="ASSOCIATION.INSTANCE"/>
  13. </xsl:template>
  14. <!-- CLASS template formats a single CIM non-association class -->
  15. <xsl:template match="CLASS">
  16. <DIV CLASS="mofclass">
  17. <SPAN CLASS="mofqualifierset"><![CDATA[ ]]><xsl:apply-templates select="QUALIFIER"/><br/></SPAN>
  18. <SPAN CLASS="mofkeyword">class</SPAN>
  19. <xsl:apply-templates select="CLASSPATH"/>
  20. <xsl:if match="*[@SUPERCLASS]">
  21. <SPAN CLASS="mofsymbol">: </SPAN><xsl:value-of select="@SUPERCLASS"/>
  22. </xsl:if>
  23. <BR/>
  24. <SPAN CLASS="mofsymbol">{</SPAN><BR/>
  25. <xsl:apply-templates select="PROPERTY"/>
  26. <xsl:apply-templates select="PROPERTY.ARRAY"/>
  27. <xsl:apply-templates select="METHOD"/>
  28. <SPAN CLASS="mofsymbol">};</SPAN>
  29. </DIV>
  30. </xsl:template>
  31. <!-- QUALIFIER template formats a list of qualifier name/value pairs -->
  32. <xsl:template match="QUALIFIER">
  33. <xsl:if match="QUALIFIER[0]"><SPAN CLASS="mofsymbol">[</SPAN></xsl:if>
  34. <SPAN CLASS="mofqualifier"><xsl:value-of select="@NAME"/></SPAN>
  35. <SPAN CLASS="mofsymbol">(</SPAN><xsl:apply-templates/><SPAN CLASS="mofsymbol">)</SPAN><xsl:if match="QUALIFIER[$not$ end()]">,
  36. </xsl:if>
  37. <xsl:if match="QUALIFIER[end()]"><SPAN CLASS="mofsymbol">]</SPAN>
  38. </xsl:if>
  39. </xsl:template>
  40. <!-- VALUE template formats a non-array property or qualifier value -->
  41. <xsl:template match="VALUE">
  42. <xsl:if match="PROPERTY/VALUE"><SPAN CLASS="mofsymbol">=</SPAN></xsl:if>
  43. <xsl:choose>
  44. <xsl:when match="*[@TYPE='string']/VALUE"><SPAN CLASS="mofstring">"<xsl:value-of/>"</SPAN></xsl:when>
  45. <xsl:when match="*[@TYPE='datetime']/VALUE"><SPAN CLASS="mofstring">"<xsl:value-of/>"</SPAN></xsl:when>
  46. <xsl:when match="*[@TYPE='char16']/VALUE"><SPAN CLASS="mofchar">'<xsl:value-of/>'</SPAN></xsl:when>
  47. <xsl:otherwise><SPAN CLASS="mofvalue"><xsl:value-of/></SPAN></xsl:otherwise>
  48. </xsl:choose>
  49. </xsl:template>
  50. <!-- CLASSPATH template -->
  51. <xsl:template match="CLASSPATH">
  52. <xsl:value-of select="@CLASSNAME"/>
  53. </xsl:template>
  54. <!-- PROPERTY template formats a single CIM non-array property -->
  55. <xsl:template match="PROPERTY">
  56. <DD>
  57. <DIV CLASS="mofproperty">
  58. <SPAN CLASS="mofqualifierset"><![CDATA[ ]]><xsl:apply-templates select="QUALIFIER"/></SPAN>
  59. <SPAN CLASS="mofkeyword"><xsl:value-of select="@TYPE"/></SPAN>
  60. <SPAN CLASS="mofproperty"><xsl:value-of select="@NAME"/></SPAN>
  61. <xsl:apply-templates select="VALUE"/>
  62. <SPAN CLASS="mofsymbol">;</SPAN><BR/>
  63. </DIV>
  64. </DD>
  65. </xsl:template>
  66. <!-- PROPERTY.ARRAY template formats a single CIM array property -->
  67. <xsl:template match="PROPERTY.ARRAY">
  68. <DD>
  69. <DIV CLASS="mofproperty">
  70. <SPAN CLASS="mofqualifierset"><![CDATA[ ]]><xsl:apply-templates select="QUALIFIER"/></SPAN>
  71. <SPAN CLASS="mofkeyword"><xsl:value-of select="@TYPE"/></SPAN>
  72. <SPAN CLASS="mofproperty"><xsl:value-of select="@NAME"/></SPAN>
  73. <SPAN CLASS="mofsymbol">[</SPAN><xsl:value-of select="@ARRAYSIZE"/><SPAN CLASS="mofsymbol">]</SPAN>
  74. <xsl:apply-templates select="VALUE.INDEXED"/><SPAN CLASS="mofsymbol">;</SPAN><BR/>
  75. </DIV>
  76. </DD>
  77. </xsl:template>
  78. <!-- METHOD template formats a single CIM method -->
  79. <xsl:template match="METHOD">
  80. <DIV CLASS="mofmethod">
  81. <SPAN CLASS="mofqualifierset"><![CDATA[ ]]><xsl:apply-templates select="QUALIFIER"/></SPAN>
  82. <SPAN CLASS="mofkeyword"><xsl:value-of select="@TYPE"/></SPAN>
  83. <SPAN CLASS="mofmethod"><xsl:value-of select="@NAME"/></SPAN>
  84. <SPAN CLASS="mofsymbol">(</SPAN>
  85. <xsl:apply-templates select="METHODPARAMETER"/>
  86. <SPAN CLASS="mofsymbol">);</SPAN>
  87. </DIV>
  88. </xsl:template>
  89. <!-- METHOD.PARAMETER template formats a single CIM method parameter -->
  90. <xsl:template match="METHODPARAMETER">
  91. <DIV CLASS="mofmethodparameter">
  92. <SPAN CLASS="mofqualifierset"><![CDATA[ ]]><xsl:apply-templates select="QUALIFIER"/></SPAN>
  93. <xsl:choose>
  94. <xsl:when match="METHODPARAMETER/PARAMETER">
  95. <SPAN CLASS="mofkeyword"><xsl:value-of select="METHODPARAMETER/PARAMETER[@TYPE]"/></SPAN>
  96. </xsl:when>
  97. <xsl:when match="METHODPARAMETER/PARAMETER.REFERENCE">
  98. <SPAN CLASS="mofkeyword">object ref</SPAN>
  99. </xsl:when>
  100. <xsl:when match="METHODPARAMETER/PARAMETER.REFERENCE[@REFERENCECLASS]">
  101. <SPAN CLASS="mofkeyword"><xsl:value-of select="METHODPARAMETER/PARAMETER.REFERENCE[@REFERENCECLASS]"/> ref</SPAN>
  102. </xsl:when>
  103. </xsl:choose>
  104. <xsl:value-of select="@NAME"/><xsl:if match="METHODPARAMETER[$not$ end()]"><SPAN CLASS="mofsymbol">,</SPAN>
  105. </xsl:if>
  106. </DIV>
  107. </xsl:template>
  108. <!-- INSTANCE template formats a single CIM non-association instance -->
  109. <xsl:template match="INSTANCE">
  110. <DIV CLASS="mofinstance">
  111. <SPAN CLASS="mofqualifierset"><![CDATA[ ]]><xsl:apply-templates select="QUALIFIER"/><br/></SPAN>
  112. <SPAN CLASS="mofkeyword">instance of</SPAN>
  113. <xsl:value-of select="@CLASSNAME"/>
  114. <SPAN CLASS="mofsymbol">{</SPAN><BR/>
  115. <DL>
  116. <xsl:apply-templates select="PROPERTY"/>
  117. <xsl:apply-templates select="PROPERTY.ARRAY"/>
  118. </DL>
  119. <SPAN CLASS="mofsymbol">};</SPAN>
  120. </DIV>
  121. </xsl:template>
  122. <!-- INSTANCEPATH template -->
  123. <xsl:template match="INSTANCEPATH">
  124. <xsl:value-of select="@CLASSNAME"/>
  125. </xsl:template>
  126. <!-- VALUE.REFERENCE template formats a reference property value -->
  127. <xsl:template match="VALUE.REFERENCE">
  128. <SPAN CLASS="mofsymbol">=</SPAN>
  129. <SPAN CLASS="mofstring">"<xsl:apply-templates/>"</SPAN>
  130. </xsl:template>
  131. <xsl:template match="VALUE.REFERENCE/CLASSPATH">
  132. <xsl:apply-templates match="NAMESPACEPATH"/>:<xsl:value-of select="@CLASSNAME"/>
  133. </xsl:template>
  134. <xsl:template match="VALUE.REFERENCE/INSTANCEPATH">
  135. <xsl:apply-templates match="NAMESPACEPATH"/>:<xsl:value-of select="@CLASSNAME"/>.<xsl:apply-templates match="KEYBINDING"/>
  136. </xsl:template>
  137. <!-- NAMESPACEPATH template formats a reference property value -->
  138. <xsl:template match="NAMESPACEPATH">
  139. <xsl:if match="NAMESPACEPATH[HOST]">//<xsl:value-of match="HOST"/></xsl:if><xsl:apply-templates match="NAMESPACE"/>
  140. </xsl:template>
  141. <xsl:template match="NAMESPACE">/<xsl:value-of select="@NAME"/><xsl:apply-templates match="NAMESPACE"/></xsl:template>
  142. <!-- KEYBINDING template formats a reference property value -->
  143. <xsl:template match="KEYBINDING">
  144. <xsl:value-of select="@NAME"/>=<xsl:apply-templates/><xsl:if match="KEYBINDING[$not$ end()]">,</xsl:if>
  145. </xsl:template>
  146. <xsl:template match="KEYVALUE">
  147. <xsl:choose>
  148. <xsl:when match="*[@TYPE='string']/VALUE"><SPAN CLASS="mofstring">"<xsl:value-of/>"</SPAN></xsl:when>
  149. <xsl:when match="*[@TYPE='datetime']/VALUE"><SPAN CLASS="mofstring">"<xsl:value-of/>"</SPAN></xsl:when>
  150. <xsl:when match="*[@TYPE='char16']/VALUE"><SPAN CLASS="mofchar">"<xsl:value-of/>"</SPAN></xsl:when>
  151. <xsl:otherwise><SPAN CLASS="mofvalue"><xsl:value-of/></SPAN></xsl:otherwise>
  152. </xsl:choose>
  153. </xsl:template>
  154. <xsl:template match="KEYVALUE.REFERENCE">
  155. <SPAN CLASS="mofstring">"<xsl:apply-templates/>"</SPAN>
  156. </xsl:template>
  157. <!-- ASSOCIATION.CLASS template formats a single CIM association class -->
  158. <xsl:template match="ASSOCIATION.CLASS">
  159. <DIV CLASS="mofclass">
  160. <SPAN CLASS="mofqualifierset"><![CDATA[ ]]><xsl:apply-templates select="QUALIFIER"/><br/></SPAN>
  161. <SPAN CLASS="mofkeyword">class</SPAN>
  162. <xsl:apply-templates select="CLASSPATH"/>
  163. <xsl:if match="*[@SUPERCLASS]">
  164. <SPAN CLASS="mofsymbol">: </SPAN><xsl:value-of select="@SUPERCLASS"/>
  165. </xsl:if>
  166. <BR/>
  167. <SPAN CLASS="mofsymbol">{</SPAN><BR/>
  168. <xsl:apply-templates select="REFERENCE"/>
  169. <xsl:apply-templates select="PROPERTY"/>
  170. <xsl:apply-templates select="PROPERTY.ARRAY"/>
  171. <xsl:apply-templates select="METHOD"/>
  172. <SPAN CLASS="mofsymbol">};</SPAN>
  173. </DIV>
  174. </xsl:template>
  175. <!-- REFERENCE template formats a single CIM reference property -->
  176. <xsl:template match="REFERENCE">
  177. <DIV CLASS="mofproperty">
  178. <SPAN CLASS="mofqualifierset"><![CDATA[ ]]><xsl:apply-templates select="QUALIFIER"/></SPAN>
  179. <SPAN CLASS="mofkeyword">
  180. <xsl:choose>
  181. <xsl:when match="*[@REFERENCECLASS]"><xsl:value-of select="@REFERENCECLASS"/> ref</xsl:when>
  182. <xsl:otherwise>object ref</xsl:otherwise>
  183. </xsl:choose>
  184. </SPAN>
  185. <SPAN CLASS="mofproperty"><xsl:value-of select="@role"/></SPAN>
  186. <xsl:apply-templates select="VALUE.REFERENCE"/>
  187. <SPAN CLASS="mofsymbol">;</SPAN><BR/>
  188. </DIV>
  189. </xsl:template>
  190. <!-- ASSOCIATION.INSTANCE template formats a single CIM association instance -->
  191. <xsl:template match="ASSOCIATION.INSTANCE">
  192. <DIV CLASS="mofinstance">
  193. <SPAN CLASS="mofqualifierset"><![CDATA[ ]]><xsl:apply-templates select="QUALIFIER"/><br/></SPAN>
  194. <SPAN CLASS="mofkeyword">instance of</SPAN>
  195. <xsl:apply-templates select="INSTANCEPATH"/>
  196. <SPAN CLASS="mofsymbol">{</SPAN><BR/>
  197. <xsl:apply-templates select="REFERENCE"/>
  198. <xsl:apply-templates select="PROPERTY"/>
  199. <xsl:apply-templates select="PROPERTY.ARRAY"/>
  200. <SPAN CLASS="mofsymbol">};</SPAN>
  201. </DIV>
  202. </xsl:template>
  203. </xsl:stylesheet>