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.

498 lines
16 KiB

  1. <?xml version="1.0"?>
  2. <!-- TODO: qualifier flavors here + extend XML translator to generate WMI-specific flavors too-->
  3. <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
  4. <!-- Root template selects all children of the CIM/DECLARATIONS tag -->
  5. <xsl:template match="/">
  6. <xsl:apply-templates select="CIM//CLASS"/>
  7. <xsl:apply-templates select="CIM//INSTANCE"/>
  8. </xsl:template>
  9. <!-- QUALIFIER template formats a list of qualifier name/value pairs -->
  10. <xsl:template match="QUALIFIER">
  11. <xsl:if match="QUALIFIER[0]">[</xsl:if>
  12. <xsl:value-of select="@NAME"/>(<xsl:apply-templates/>)
  13. <xsl:if match="QUALIFIER[$not$ end()]">,</xsl:if>
  14. <xsl:if match="QUALIFIER[end()]">]</xsl:if>
  15. </xsl:template>
  16. <!-- VALUE template formats a non-array property or qualifier value -->
  17. <xsl:template match="VALUE">
  18. <xsl:if match="PROPERTY/VALUE">=</xsl:if>
  19. <xsl:choose>
  20. <xsl:when match="*[@TYPE='string']/VALUE">"<xsl:value-of/>"</xsl:when>
  21. <xsl:when match="*[@TYPE='datetime']/VALUE">"<xsl:value-of/>"</xsl:when>
  22. <xsl:when match="*[@TYPE='char16']/VALUE">'<xsl:value-of/>'</xsl:when>
  23. <xsl:otherwise><xsl:value-of/></xsl:otherwise>
  24. </xsl:choose>
  25. <xsl:if match="VALUE[$not$ end()]">,</xsl:if>
  26. </xsl:template>
  27. <!-- VALUE.ARRAY template formats a single element from an array -->
  28. <!-- property or qualifier value -->
  29. <xsl:template match="VALUE.ARRAY">
  30. {<xsl:apply-templates/>}
  31. </xsl:template>
  32. <!-- VALUE.INDEXED template formats a single element from an array -->
  33. <!-- property or qualifier value -->
  34. <xsl:template match="VALUE.INDEXED">
  35. <xsl:if match="VALUE.INDEXED[0]">{</xsl:if>
  36. <xsl:choose>
  37. <xsl:when match="*[@TYPE='string']/VALUE.INDEXED"><SPAN CLASS="mofstring">"<xsl:value-of/>"</SPAN></xsl:when>
  38. <xsl:when match="*[@TYPE='datetime']/VALUE.INDEXED"><SPAN CLASS="mofstring">"<xsl:value-of/>"</SPAN></xsl:when>
  39. <xsl:when match="*[@TYPE='char16']/VALUE.INDEXED"><SPAN CLASS="mofchar">'<xsl:value-of/>'</SPAN></xsl:when>
  40. <xsl:otherwise><SPAN CLASS="mofvalue"><xsl:value-of/></SPAN></xsl:otherwise>
  41. </xsl:choose>
  42. <xsl:if match="VALUE.INDEXED[$not$ end()]">,</xsl:if>
  43. <xsl:if match="VALUE.INDEXED[end()]">}</xsl:if>
  44. </xsl:template>
  45. <!-- VALUE.REFERENCE template formats a reference property value -->
  46. <xsl:template match="VALUE.REFERENCE">
  47. = "<xsl:apply-templates/>"
  48. </xsl:template>
  49. <xsl:template match="VALUE.REFERENCE/CLASSPATH">
  50. <xsl:apply-templates match="NAMESPACEPATH"/>:<xsl:value-of match="CLASSNAME"/>
  51. </xsl:template>
  52. <xsl:template match="VALUE.REFERENCE/INSTANCEPATH">
  53. <xsl:apply-templates match="NAMESPACEPATH"/>:<xsl:value-of match="CLASSNAME"/>.<xsl:apply-templates match="KEYBINDING"/>
  54. </xsl:template>
  55. <!-- NAMESPACEPATH template formats a reference property value -->
  56. <xsl:template match="NAMESPACEPATH">
  57. <xsl:if match="NAMESPACEPATH[HOST]">//<xsl:value-of match="HOST"/></xsl:if><xsl:apply-templates match="NAMESPACE"/>
  58. </xsl:template>
  59. <xsl:template match="NAMESPACE">/<xsl:value-of select="@NAME"/><xsl:apply-templates match="NAMESPACE"/></xsl:template>
  60. <!-- KEYBINDING template formats a reference property value -->
  61. <xsl:template match="KEYBINDING">
  62. <xsl:value-of select="@NAME"/>=<xsl:apply-templates/><xsl:if match="KEYBINDING[$not$ end()]">,</xsl:if>
  63. </xsl:template>
  64. <xsl:template match="KEYVALUE">
  65. <xsl:choose>
  66. <xsl:when match="*[@TYPE='numeric']/VALUE"><SPAN CLASS="mofvalue"><xsl:value-of/></SPAN></xsl:when>
  67. <xsl:when match="*[@TYPE='boolean']/VALUE"><SPAN CLASS="mofvalue"><xsl:value-of/></SPAN></xsl:when>
  68. <xsl:otherwise><SPAN CLASS="mofstring">"<xsl:value-of/>"</SPAN></xsl:otherwise>
  69. </xsl:choose>
  70. </xsl:template>
  71. <!-- INSTANCE template formats a single CIM non-association instance -->
  72. <xsl:template match="INSTANCE">
  73. <TABLE WIDTH="100%">
  74. <TR><TD BGCOLOR="red"><FONT SIZE="+2"><STRONG>
  75. <A LANGUAGE="javascript">
  76. <xsl:attribute name="ID">
  77. <xsl:value-of select="@CLASSNAME"/>
  78. </xsl:attribute>
  79. <xsl:attribute name="TITLE">
  80. <xsl:for-each select="QUALIFIER[@NAME = 'Description']">
  81. <xsl:value-of select="VALUE"/>
  82. </xsl:for-each>
  83. </xsl:attribute>
  84. <xsl:value-of select="@CLASSNAME"/>
  85. </A>
  86. instance
  87. </STRONG>
  88. </FONT></TD></TR>
  89. </TABLE>
  90. <FONT SIZE="-1">Key values are denoted with *</FONT>
  91. <P/>
  92. <xsl:if match="INSTANCE[PROPERTY $or$ PROPERTY.ARRAY]">
  93. <STRONG>Properties:</STRONG>
  94. <UL><TABLE>
  95. <xsl:apply-templates select="PROPERTY"/>
  96. <xsl:apply-templates select="PROPERTY.ARRAY"/>
  97. </TABLE></UL>
  98. </xsl:if>
  99. <xsl:if match="INSTANCE[PROPERTY.REFERENCE]">
  100. <STRONG>References:</STRONG>
  101. <UL><TABLE>
  102. <xsl:apply-templates select="PROPERTY.REFERENCE"/>
  103. </TABLE></UL>
  104. </xsl:if>
  105. <xsl:if match="INSTANCE[METHOD]">
  106. <STRONG>Methods:</STRONG>
  107. <UL><TABLE>
  108. <xsl:apply-templates select="METHOD"/>
  109. </TABLE></UL>
  110. </xsl:if>
  111. <!-- Associated object code. This needs some work for instances
  112. <P/>
  113. <STRONG>Associations:</STRONG>
  114. <P>
  115. <xsl:for-each select="ancestor(CIM)//INSTANCE/PROPERTY.REFERENCE[@REFERENCECLASS = context()/@NAME]">
  116. <LI/>
  117. <B><xsl:value-of select="./@REFERENCECLASS"/></B>
  118. is associated to
  119. <xsl:for-each select="ancestor(CLASS)/PROPERTY.REFERENCE[@NAME != context()/@NAME]">
  120. <B><A HREF="#" LANGUAGE="javascript" ID="Associated">
  121. <xsl:attribute name="onclick">
  122. return parent.options.control.GetClass("<xsl:value-of select="./@REFERENCECLASS"/>")
  123. </xsl:attribute>
  124. <xsl:value-of select="./@REFERENCECLASS"/></A></B>
  125. </xsl:for-each>
  126. as the <xsl:value-of select="./@NAME"/>
  127. property of the
  128. <B><A HREF="#" LANGUAGE="javascript" ID="Reference">
  129. <xsl:attribute name="onclick">
  130. return parent.options.control.GetClass("<xsl:value-of select="ancestor(CLASS)/@NAME"/>")
  131. </xsl:attribute>
  132. <xsl:value-of select="ancestor(CLASS)/@NAME"/></A></B>
  133. association.<P/>
  134. </xsl:for-each>
  135. </P>
  136. -->
  137. </xsl:template>
  138. <!-- CLASS template formats a single CIM non-association class -->
  139. <xsl:template match="CLASS">
  140. <TABLE WIDTH="100%">
  141. <TR><TD BGCOLOR="red"><FONT SIZE="+2"><STRONG>
  142. <A LANGUAGE="javascript">
  143. <xsl:attribute name="ID">
  144. <xsl:value-of select="@NAME"/>
  145. </xsl:attribute>
  146. <xsl:attribute name="TITLE">
  147. <xsl:for-each select="QUALIFIER[@NAME = 'Description']">
  148. <xsl:value-of select="VALUE"/>
  149. </xsl:for-each>
  150. </xsl:attribute>
  151. <xsl:value-of select="@NAME"/>
  152. </A>
  153. </STRONG>
  154. <xsl:if match="*[@SUPERCLASS]">
  155. : <xsl:value-of select="@SUPERCLASS"/>
  156. </xsl:if>
  157. </FONT></TD></TR>
  158. </TABLE>
  159. <FONT SIZE="-1">Key values are denoted with *</FONT>
  160. <P/>
  161. <xsl:if match="CLASS[PROPERTY $or$ PROPERTY.ARRAY]">
  162. <STRONG>Properties:</STRONG>
  163. <UL><TABLE>
  164. <xsl:apply-templates select="PROPERTY"/>
  165. <xsl:apply-templates select="PROPERTY.ARRAY"/>
  166. </TABLE></UL>
  167. </xsl:if>
  168. <xsl:if match="CLASS[PROPERTY.REFERENCE]">
  169. <STRONG>References:</STRONG>
  170. <UL><TABLE>
  171. <xsl:apply-templates select="PROPERTY.REFERENCE"/>
  172. </TABLE></UL>
  173. </xsl:if>
  174. <xsl:if match="CLASS[METHOD]">
  175. <STRONG>Methods:</STRONG>
  176. <UL><TABLE>
  177. <xsl:apply-templates select="METHOD"/>
  178. </TABLE></UL>
  179. </xsl:if>
  180. <!-- Associated object code. Needs context() support to work
  181. <P/>
  182. <STRONG>Associations:</STRONG>
  183. <P>
  184. <xsl:for-each select="ancestor(CIM)//CLASS/PROPERTY.REFERENCE[@REFERENCECLASS = context()/@NAME]">
  185. <LI/>
  186. <B><xsl:value-of select="./@REFERENCECLASS"/></B>
  187. is associated to
  188. <xsl:for-each select="ancestor(CLASS)/PROPERTY.REFERENCE[@NAME != context()/@NAME]">
  189. <B><A HREF="#" LANGUAGE="javascript" ID="Associated">
  190. <xsl:attribute name="onclick">
  191. return parent.options.control.GetClass("<xsl:value-of select="./@REFERENCECLASS"/>")
  192. </xsl:attribute>
  193. <xsl:value-of select="./@REFERENCECLASS"/></A></B>
  194. </xsl:for-each>
  195. as the <xsl:value-of select="./@NAME"/>
  196. property of the
  197. <B><A HREF="#" LANGUAGE="javascript" ID="Reference">
  198. <xsl:attribute name="onclick">
  199. return parent.options.control.GetClass("<xsl:value-of select="ancestor(CLASS)/@NAME"/>")
  200. </xsl:attribute>
  201. <xsl:value-of select="ancestor(CLASS)/@NAME"/></A></B>
  202. association.<P/>
  203. </xsl:for-each>
  204. </P>
  205. -->
  206. </xsl:template>
  207. <!-- REFERENCE template formats a single CIM reference property -->
  208. <xsl:template match="PROPERTY.REFERENCE">
  209. <TR><TD WIDTH="100">
  210. <A HREF="#" LANGUAGE="javascript">
  211. <xsl:attribute name="ID">
  212. <xsl:value-of select="@NAME"/>
  213. </xsl:attribute>
  214. <xsl:attribute name="onclick">
  215. return parent.options.control.GetClass("<xsl:value-of select="@REFERENCECLASS"/>")
  216. </xsl:attribute>
  217. <xsl:value-of select="@REFERENCECLASS"/>
  218. </A>
  219. </TD><TD>
  220. <xsl:for-each select="QUALIFIER[@NAME = 'key']">*</xsl:for-each>
  221. <A LANGUAGE="javascript">
  222. <xsl:attribute name="ID">
  223. <xsl:value-of select="@NAME"/>
  224. </xsl:attribute>
  225. <xsl:attribute name="TITLE">
  226. <xsl:for-each select="QUALIFIER[@NAME = 'Description']">
  227. <xsl:value-of select="VALUE"/>
  228. </xsl:for-each>
  229. </xsl:attribute>
  230. <xsl:value-of select="@NAME"/>
  231. </A>
  232. </TD><TD>
  233. <xsl:apply-templates select="VALUE.REFERENCE"/>
  234. </TD></TR>
  235. </xsl:template>
  236. <!-- PROPERTY template formats a single CIM non-array property -->
  237. <xsl:template match="PROPERTY">
  238. <TR><TD WIDTH="100">
  239. <xsl:value-of select="@TYPE"/>
  240. </TD><TD>
  241. <xsl:for-each select="QUALIFIER[@NAME = 'key']">*</xsl:for-each>
  242. <A LANGUAGE="javascript">
  243. <xsl:attribute name="ID">
  244. <xsl:value-of select="@NAME"/>
  245. </xsl:attribute>
  246. <xsl:attribute name="TITLE">
  247. <xsl:for-each select="QUALIFIER[@NAME = 'Description']">
  248. <xsl:value-of select="VALUE"/>
  249. </xsl:for-each>
  250. </xsl:attribute>
  251. <xsl:value-of select="@NAME"/>
  252. </A>
  253. </TD><TD>
  254. <xsl:apply-templates select="VALUE"/>
  255. </TD></TR>
  256. </xsl:template>
  257. <!-- PROPERTY.ARRAY template formats a single CIM array property -->
  258. <xsl:template match="PROPERTY.ARRAY">
  259. <TR><TD WIDTH="100">
  260. <xsl:value-of select="@TYPE"/>
  261. </TD><TD>
  262. <xsl:for-each select="QUALIFIER[@NAME = 'key']">*</xsl:for-each>
  263. <A LANGUAGE="javascript">
  264. <xsl:attribute name="ID">
  265. <xsl:value-of select="@NAME"/>
  266. </xsl:attribute>
  267. <xsl:attribute name="TITLE">
  268. <xsl:for-each select="QUALIFIER[@NAME = 'Description']">
  269. <xsl:value-of select="VALUE"/>
  270. </xsl:for-each>
  271. </xsl:attribute>
  272. <xsl:value-of select="@NAME"/>
  273. </A>
  274. [<xsl:value-of select="ARRAYSIZE"/>]
  275. </TD><TD>
  276. <xsl:apply-templates select="VALUE.INDEXED"/>
  277. </TD></TR>
  278. </xsl:template>
  279. <!-- METHOD template formats a single CIM method -->
  280. <xsl:template match="METHOD">
  281. <TR><TD WIDTH="100">
  282. <xsl:value-of select="@TYPE"/>
  283. </TD><TD>
  284. <A LANGUAGE="javascript">
  285. <xsl:attribute name="ID">
  286. <xsl:value-of select="@NAME"/>
  287. </xsl:attribute>
  288. <xsl:attribute name="TITLE">
  289. <xsl:for-each select="QUALIFIER[@NAME = 'Description']">
  290. <xsl:value-of select="VALUE"/>
  291. </xsl:for-each>
  292. </xsl:attribute>
  293. <xsl:value-of select="@NAME"/>
  294. </A>
  295. </TD><TD>(</TD></TR>
  296. <xsl:apply-templates select="PARAMETER"/>
  297. <xsl:apply-templates select="PARAMETER.ARRAY"/>
  298. <xsl:apply-templates select="PARAMETER.OBJECT"/>
  299. <xsl:apply-templates select="PARAMETER.OBJECTARRAY"/>
  300. <xsl:apply-templates select="PARAMETER.REFERENCE"/>
  301. <xsl:apply-templates select="PARAMETER.REFARRAY"/>
  302. <TR><TD></TD><TD></TD>
  303. <TD>)</TD></TR>
  304. </xsl:template>
  305. <!-- PARAMETER template formats a single CIM method parameter -->
  306. <xsl:template match="PARAMETER">
  307. <TR><TD></TD><TD></TD><TD>
  308. <xsl:value-of select="@TYPE"/>
  309. </TD><TD>
  310. <A LANGUAGE="javascript">
  311. <xsl:attribute name="ID">
  312. <xsl:value-of select="@NAME"/>
  313. </xsl:attribute>
  314. <xsl:attribute name="TITLE">
  315. <xsl:for-each select="QUALIFIER[@NAME = 'Description']">
  316. <xsl:value-of select="VALUE"/>
  317. </xsl:for-each>
  318. </xsl:attribute>
  319. <xsl:value-of select="@NAME"/>
  320. </A>
  321. </TD></TR>
  322. </xsl:template>
  323. <!-- PARAMETER.ARRAY template formats a single CIM method parameter -->
  324. <xsl:template match="PARAMETER.ARRAY">
  325. <TR><TD></TD><TD></TD><TD>
  326. <xsl:value-of select="@TYPE"/>
  327. </TD><TD>
  328. <A LANGUAGE="javascript">
  329. <xsl:attribute name="ID">
  330. <xsl:value-of select="@NAME"/>
  331. </xsl:attribute>
  332. <xsl:attribute name="TITLE">
  333. <xsl:for-each select="QUALIFIER[@NAME = 'Description']">
  334. <xsl:value-of select="VALUE"/>
  335. </xsl:for-each>
  336. </xsl:attribute>
  337. <xsl:value-of select="@NAME"/>[]
  338. </A>
  339. </TD></TR>
  340. </xsl:template>
  341. <!-- PARAMETER.OBJECT template formats a single CIM method parameter -->
  342. <xsl:template match="PARAMETER.OBJECT">
  343. <TR><TD></TD><TD></TD><TD>
  344. <xsl:choose>
  345. <xsl:when match="*[@REFERENCECLASS]">
  346. <xsl:value-of select="@REFERENCECLASS"/> ref
  347. </xsl:when>
  348. <xsl:otherwise>
  349. object ref
  350. </xsl:otherwise>
  351. </xsl:choose>
  352. </TD><TD>
  353. <A LANGUAGE="javascript">
  354. <xsl:attribute name="ID">
  355. <xsl:value-of select="@NAME"/>
  356. </xsl:attribute>
  357. <xsl:attribute name="TITLE">
  358. <xsl:for-each select="QUALIFIER[@NAME = 'Description']">
  359. <xsl:value-of select="VALUE"/>
  360. </xsl:for-each>
  361. </xsl:attribute>
  362. <xsl:value-of select="@NAME"/>
  363. </A>
  364. </TD></TR>
  365. </xsl:template>
  366. <!-- PARAMETER.OBJECTARRAY template formats a single CIM method parameter -->
  367. <xsl:template match="PARAMETER.OBJECTARRAY">
  368. <TR><TD></TD><TD></TD><TD>
  369. <xsl:choose>
  370. <xsl:when match="*[@REFERENCECLASS]">
  371. <xsl:value-of select="@REFERENCECLASS"/> ref
  372. </xsl:when>
  373. <xsl:otherwise>
  374. object ref
  375. </xsl:otherwise>
  376. </xsl:choose>
  377. </TD><TD>
  378. <A LANGUAGE="javascript">
  379. <xsl:attribute name="ID">
  380. <xsl:value-of select="@NAME"/>
  381. </xsl:attribute>
  382. <xsl:attribute name="TITLE">
  383. <xsl:for-each select="QUALIFIER[@NAME = 'Description']">
  384. <xsl:value-of select="VALUE"/>
  385. </xsl:for-each>
  386. </xsl:attribute>
  387. <xsl:value-of select="@NAME"/>[]
  388. </A>
  389. </TD></TR>
  390. </xsl:template>
  391. <!-- PARAMETER.REFERENCE template formats a single CIM method parameter -->
  392. <xsl:template match="PARAMETER.REFERENCE">
  393. <TR><TD></TD><TD></TD><TD>
  394. <xsl:choose>
  395. <xsl:when match="*[@REFERENCECLASS]">
  396. <xsl:value-of select="@REFERENCECLASS"/> ref
  397. </xsl:when>
  398. <xsl:otherwise>
  399. object ref
  400. </xsl:otherwise>
  401. </xsl:choose>
  402. </TD><TD>
  403. <A LANGUAGE="javascript">
  404. <xsl:attribute name="ID">
  405. <xsl:value-of select="@NAME"/>
  406. </xsl:attribute>
  407. <xsl:attribute name="TITLE">
  408. <xsl:for-each select="QUALIFIER[@NAME = 'Description']">
  409. <xsl:value-of select="VALUE"/>
  410. </xsl:for-each>
  411. </xsl:attribute>
  412. <xsl:value-of select="@NAME"/>
  413. </A>
  414. </TD></TR>
  415. </xsl:template>
  416. <!-- PARAMETER.REFARRAY template formats a single CIM method parameter -->
  417. <xsl:template match="PARAMETER.REFARRAY">
  418. <TR><TD></TD><TD></TD><TD>
  419. <xsl:choose>
  420. <xsl:when match="*[@REFERENCECLASS]">
  421. <xsl:value-of select="@REFERENCECLASS"/> ref
  422. </xsl:when>
  423. <xsl:otherwise>
  424. object ref
  425. </xsl:otherwise>
  426. </xsl:choose>
  427. </TD><TD>
  428. <A LANGUAGE="javascript">
  429. <xsl:attribute name="ID">
  430. <xsl:value-of select="@NAME"/>
  431. </xsl:attribute>
  432. <xsl:attribute name="TITLE">
  433. <xsl:for-each select="QUALIFIER[@NAME = 'Description']">
  434. <xsl:value-of select="VALUE"/>
  435. </xsl:for-each>
  436. </xsl:attribute>
  437. <xsl:value-of select="@NAME"/>[]
  438. </A>
  439. </TD></TR>
  440. </xsl:template>
  441. </xsl:stylesheet>