home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / WindowsServerTrial / server.iso / sources / install.wim / 2 / Windows / System32 / wbem / en-US / htable.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2008-01-19  |  4.5 KB  |  105 lines

  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.  
  8. <xsl:template match="COMMAND">
  9. <table border="1">
  10.     <tr style="background-color:#a0a0ff;font:10pt Tahoma;font-weight:bold;" align="left">
  11.     <td>Node</td>
  12.     <xsl:for-each select="RESULTS[1]/CIM/INSTANCE[1]/PROPERTY|RESULTS[1]/CIM/INSTANCE[1]/PROPERTY.ARRAY|RESULTS[1]/CIM/INSTANCE[1]/PROPERTY.REFERENCE">
  13.         <td>
  14.         <xsl:value-of select="@NAME"/>
  15.         </td>
  16.     </xsl:for-each>
  17.     </tr>
  18.     <tr style="background-color:#e0f0f0;font:10pt Tahoma;">
  19.     <xsl:for-each select="RESULTS/CIM/INSTANCE">
  20.         <xsl:sort select="PROPERTY[@NAME=$sortby]|PROPERTY.ARRAY[@NAME=$sortby]|PROPERTY.REFERENCE[@NAME=$sortby]" data-type="{$datatype}"/>
  21.         <xsl:choose>
  22.         <xsl:when test="position() mod 2 < 1">
  23.             <tr style="background-color:#e0f0f0;font:10pt Tahoma;">
  24.             <td align="left"><xsl:value-of select="../../@NODE"/></td>
  25.             <xsl:for-each select="PROPERTY|PROPERTY.ARRAY|PROPERTY.REFERENCE">
  26.                 <xsl:variable name="typevar" select="@TYPE"/>
  27.                 <td>
  28.                 <xsl:for-each select="VALUE|VALUE.ARRAY|VALUE.REFERENCE">
  29.                     <xsl:apply-templates select=".">
  30.                         <xsl:with-param name="type">
  31.                             <xsl:value-of select="$typevar"/>
  32.                         </xsl:with-param>
  33.                     </xsl:apply-templates>
  34.                 </xsl:for-each>
  35.                 <span style="height:1px;overflow-y:hidden">.</span></td>
  36.             </xsl:for-each>
  37.             </tr>
  38.         </xsl:when>
  39.         <xsl:otherwise>
  40.             <tr style="background-color:#f0f0f0;font:10pt Tahoma;">
  41.             <td align="left"><xsl:value-of select="../../@NODE"/></td>
  42.             <xsl:for-each select="PROPERTY|PROPERTY.ARRAY|PROPERTY.REFERENCE">
  43.                 <xsl:variable name="typevar" select="@TYPE"/>
  44.                 <td>
  45.                 <xsl:for-each select="VALUE|VALUE.ARRAY|VALUE.REFERENCE">
  46.                     <xsl:apply-templates select=".">
  47.                         <xsl:with-param name="type">
  48.                             <xsl:value-of select="$typevar"/>
  49.                         </xsl:with-param>
  50.                     </xsl:apply-templates>
  51.                 </xsl:for-each>
  52.                 <span style="height:1px;overflow-y:hidden">.</span></td>
  53.             </xsl:for-each>
  54.             </tr>
  55.         </xsl:otherwise>
  56.         </xsl:choose>
  57.     </xsl:for-each>
  58.     </tr>
  59. </table>
  60. </xsl:template>
  61. <xsl:template match="VALUE.ARRAY">
  62.     <xsl:param name="type"/>
  63.     {<xsl:for-each select="VALUE">
  64.         <xsl:apply-templates select=".">
  65.             <xsl:with-param name="type">
  66.                 <xsl:value-of select="$type"/>
  67.             </xsl:with-param>
  68.             <xsl:with-param name="isarray">true</xsl:with-param>
  69.             <xsl:with-param name="includequotes">true</xsl:with-param>
  70.         </xsl:apply-templates>
  71.         <xsl:if test="position()!=last()">,</xsl:if>
  72.     </xsl:for-each>}
  73. </xsl:template>
  74. <xsl:template match="VALUE">
  75.     <xsl:param name="type"/>
  76.     <xsl:param name="includequotes"/>
  77.     <xsl:param name="isarray"/>
  78.     <xsl:choose>
  79.         <xsl:when test="$type='string'">
  80.             <xsl:if test="$includequotes='true'">"</xsl:if><xsl:value-of select="."/><xsl:if test="$includequotes='true'">"</xsl:if>
  81.         </xsl:when>
  82.         <xsl:when test="$type='char16'">
  83.             '<xsl:value-of select="."/>'
  84.         </xsl:when>
  85.         <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'">
  86.             <xsl:if test="$isarray='true'"><xsl:value-of select="."/></xsl:if>
  87.             <xsl:if test="not($isarray='true')"><div align="right"><xsl:value-of select="."/></div></xsl:if>
  88.         </xsl:when>
  89.         <xsl:otherwise>
  90.             <xsl:value-of select="."/>
  91.         </xsl:otherwise>
  92.     </xsl:choose>
  93. </xsl:template>
  94.  
  95. <xsl:template match="VALUE.REFERENCE"><xsl:apply-templates select="INSTANCEPATH/NAMESPACEPATH"/><xsl:apply-templates select="INSTANCEPATH/INSTANCENAME|INSTANCENAME"/></xsl:template>
  96. <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>
  97. <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>
  98. <xsl:template match="/">
  99. <html>
  100. <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>
  101. <xsl:apply-templates select="COMMAND"/>
  102. </html>
  103. </xsl:template>
  104. </xsl:stylesheet>
  105.