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.

105 lines
4.5 KiB

  1. <?xml version="1.0"?>
  2. <!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
  3. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  4. <xsl:param name="sortby"/>
  5. <xsl:param name="title"/>
  6. <xsl:param name="datatype" select="'text'"/>
  7. <xsl:template match="COMMAND">
  8. <table border="1">
  9. <tr style="background-color:#a0a0ff;font:10pt Tahoma;font-weight:bold;" align="left">
  10. <td>Node</td>
  11. <xsl:for-each select="RESULTS[1]/CIM/INSTANCE[1]/PROPERTY|RESULTS[1]/CIM/INSTANCE[1]/PROPERTY.ARRAY|RESULTS[1]/CIM/INSTANCE[1]/PROPERTY.REFERENCE">
  12. <td>
  13. <xsl:value-of select="@NAME"/>
  14. </td>
  15. </xsl:for-each>
  16. </tr>
  17. <tr style="background-color:#e0f0f0;font:10pt Tahoma;">
  18. <xsl:for-each select="RESULTS/CIM/INSTANCE">
  19. <xsl:sort select="PROPERTY[@NAME=$sortby]|PROPERTY.ARRAY[@NAME=$sortby]|PROPERTY.REFERENCE[@NAME=$sortby]" data-type="{$datatype}"/>
  20. <xsl:choose>
  21. <xsl:when test="position() mod 2 &lt; 1">
  22. <tr style="background-color:#e0f0f0;font:10pt Tahoma;">
  23. <td align="left"><xsl:value-of select="../../@NODE"/></td>
  24. <xsl:for-each select="PROPERTY|PROPERTY.ARRAY|PROPERTY.REFERENCE">
  25. <xsl:variable name="typevar" select="@TYPE"/>
  26. <td>
  27. <xsl:for-each select="VALUE|VALUE.ARRAY|VALUE.REFERENCE">
  28. <xsl:apply-templates select=".">
  29. <xsl:with-param name="type">
  30. <xsl:value-of select="$typevar"/>
  31. </xsl:with-param>
  32. </xsl:apply-templates>
  33. </xsl:for-each>
  34. <span style="height:1px;overflow-y:hidden">.</span></td>
  35. </xsl:for-each>
  36. </tr>
  37. </xsl:when>
  38. <xsl:otherwise>
  39. <tr style="background-color:#f0f0f0;font:10pt Tahoma;">
  40. <td align="left"><xsl:value-of select="../../@NODE"/></td>
  41. <xsl:for-each select="PROPERTY|PROPERTY.ARRAY|PROPERTY.REFERENCE">
  42. <xsl:variable name="typevar" select="@TYPE"/>
  43. <td>
  44. <xsl:for-each select="VALUE|VALUE.ARRAY|VALUE.REFERENCE">
  45. <xsl:apply-templates select=".">
  46. <xsl:with-param name="type">
  47. <xsl:value-of select="$typevar"/>
  48. </xsl:with-param>
  49. </xsl:apply-templates>
  50. </xsl:for-each>
  51. <span style="height:1px;overflow-y:hidden">.</span></td>
  52. </xsl:for-each>
  53. </tr>
  54. </xsl:otherwise>
  55. </xsl:choose>
  56. </xsl:for-each>
  57. </tr>
  58. </table>
  59. </xsl:template>
  60. <xsl:template match="VALUE.ARRAY">
  61. <xsl:param name="type"/>
  62. {<xsl:for-each select="VALUE">
  63. <xsl:apply-templates select=".">
  64. <xsl:with-param name="type">
  65. <xsl:value-of select="$type"/>
  66. </xsl:with-param>
  67. <xsl:with-param name="isarray">true</xsl:with-param>
  68. <xsl:with-param name="includequotes">true</xsl:with-param>
  69. </xsl:apply-templates>
  70. <xsl:if test="position()!=last()">,</xsl:if>
  71. </xsl:for-each>}
  72. </xsl:template>
  73. <xsl:template match="VALUE">
  74. <xsl:param name="type"/>
  75. <xsl:param name="includequotes"/>
  76. <xsl:param name="isarray"/>
  77. <xsl:choose>
  78. <xsl:when test="$type='string'">
  79. <xsl:if test="$includequotes='true'">"</xsl:if><xsl:value-of select="."/><xsl:if test="$includequotes='true'">"</xsl:if>
  80. </xsl:when>
  81. <xsl:when test="$type='char16'">
  82. '<xsl:value-of select="."/>'
  83. </xsl:when>
  84. <xsl:when test="$type='uint16'or $type='uint32' or $type='uint64' or $type='uint8' or $type='real32'or $type='real64' or $type='sint16'or $type='sint32' or $type='sint64' or $type='sint8'">
  85. <xsl:if test="$isarray='true'"><xsl:value-of select="."/></xsl:if>
  86. <xsl:if test="not($isarray='true')"><div align="right"><xsl:value-of select="."/></div></xsl:if>
  87. </xsl:when>
  88. <xsl:otherwise>
  89. <xsl:value-of select="."/>
  90. </xsl:otherwise>
  91. </xsl:choose>
  92. </xsl:template>
  93. <xsl:template match="VALUE.REFERENCE"><xsl:apply-templates select="INSTANCEPATH/NAMESPACEPATH"/><xsl:apply-templates select="INSTANCEPATH/INSTANCENAME|INSTANCENAME"/></xsl:template>
  94. <xsl:template match="NAMESPACEPATH">\\<xsl:value-of select="HOST/text()"/><xsl:for-each select="LOCALNAMESPACEPATH/NAMESPACE">\<xsl:value-of select="@NAME"/></xsl:for-each>:</xsl:template>
  95. <xsl:template match="INSTANCENAME"><xsl:value-of select="@CLASSNAME"/><xsl:for-each select="KEYBINDING"><xsl:if test="position()=1">.</xsl:if><xsl:value-of select="@NAME"/>="<xsl:value-of select="KEYVALUE/text()"/>"<xsl:if test="position()!=last()">,</xsl:if></xsl:for-each></xsl:template>
  96. <xsl:template match="/" >
  97. <html>
  98. <H3><xsl:value-of select="$title" /> <xsl:value-of select="count(COMMAND/RESULTS/CIM/INSTANCE)"/> Instances of <xsl:value-of select="COMMAND/RESULTS/CIM/INSTANCE[1]/@CLASSNAME"/></H3>
  99. <xsl:apply-templates select="COMMAND"/>
  100. </html>
  101. </xsl:template>
  102. </xsl:stylesheet>