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 / mof.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2008-01-19  |  9.0 KB  |  224 lines

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