home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 November / PCWorld_2007-11_cd.bin / multimedia / mediacoder / MediaCoder-0.6.0.3830.exe / extensions / SysInfo.7z / sysinfo.xsl < prev   
Extensible Markup Language  |  2007-03-11  |  7KB  |  164 lines

  1. <?xml version='1.0'?>
  2.   <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3.   <xsl:output method="html"/>
  4.  
  5.   <xsl:template match="/">
  6.     <html>
  7.     <body><center>
  8.  
  9.       <xsl:apply-templates/>
  10.  
  11.     </center></body></html>
  12.   </xsl:template>
  13.  
  14.   <xsl:template match="Root">
  15.     <xsl:for-each select="./*">
  16.       <h1><xsl:value-of select="name()"/></h1>
  17.  
  18.       <xsl:choose>
  19.         <xsl:when test="name()='Metadata'">
  20.           <table border="0" margin="0" padding="0" width="100%">
  21.             <xsl:for-each select="*">
  22.               <tr>
  23.                 <td align="right" bgcolor="#EEEEEE" width="50%"><xsl:value-of select="name()"/>  </td>
  24.                 <td bgcolor="#DDDDDD">  <xsl:value-of select="text()"/></td>
  25.               </tr>
  26.             </xsl:for-each>
  27.           </table>
  28.         </xsl:when>
  29.         <xsl:otherwise>
  30.  
  31.         <xsl:for-each select="*">
  32.           <table border="0" margin="0" padding="0" width="750px">
  33.             <tr><td>
  34.               <xsl:choose>
  35.                 <xsl:when test="name()='Item'">
  36.                   <xsl:attribute name="align">center</xsl:attribute>
  37.                   <xsl:attribute name="colspan">2</xsl:attribute>
  38.                   <xsl:attribute name="style">color:#800000</xsl:attribute>
  39.                   <xsl:if test="@name">
  40.                     <h3><xsl:value-of select="@name"/></h3>
  41.                   </xsl:if>
  42.                 </xsl:when>
  43.                 <xsl:otherwise>
  44.                   <xsl:value-of select="name()"/>
  45.                 </xsl:otherwise>
  46.               </xsl:choose>
  47.             </td></tr>
  48.  
  49.             <xsl:for-each select="./*">
  50.               <tr><td>
  51.                 <xsl:choose>
  52.                   <xsl:when test="not(text())">
  53.                     <xsl:attribute name="align">center</xsl:attribute>
  54.                       <xsl:attribute name="colspan">2</xsl:attribute>
  55.                       <xsl:attribute name="style">color:#800000</xsl:attribute>
  56.                       <xsl:if test="position()!=1 and count(parent::*/child::*[not(text())])>1"><br/></xsl:if>
  57.                     </xsl:when>
  58.                     <xsl:otherwise>
  59.                       <xsl:attribute name="width">50%</xsl:attribute>
  60.                       <xsl:attribute name="align">right</xsl:attribute>
  61.                       <xsl:attribute name="bgcolor">#EEEEEE</xsl:attribute>
  62.                     </xsl:otherwise>
  63.                   </xsl:choose>
  64.                   <xsl:choose>
  65.                     <xsl:when test="@name"><xsl:value-of select="@name"/></xsl:when>
  66.                     <xsl:otherwise>
  67.                       <xsl:value-of select="name()"/>
  68.                     </xsl:otherwise>
  69.                   </xsl:choose>
  70.                   <xsl:if test="text()">  </xsl:if>
  71.                 </td>
  72.                 <xsl:if test="text()">
  73.                   <td bgcolor="#DDDDDD">  <xsl:value-of select="text()"/></td>
  74.                 </xsl:if>
  75.               </tr>
  76.  
  77.                 <!-- The following constructions involving 'hr' and 'br' are designed
  78.                      primarily for network adapters, that have deeply nested ip info -->
  79.                 <xsl:for-each select="./*">
  80.                   <tr><td>
  81.                     <xsl:choose>
  82.                       <xsl:when test="not(text())">
  83.                         <xsl:attribute name="align">center</xsl:attribute>
  84.                         <xsl:attribute name="colspan">2</xsl:attribute>
  85.                         <xsl:attribute name="style">text-decoration:underline</xsl:attribute>
  86.                         <xsl:attribute name="bgcolor">#F5F5F5</xsl:attribute>
  87.  
  88.                         <xsl:if test="name()='Configuration'"><hr noshade="true" color="#DADADA" width="50%"/></xsl:if>
  89.                       </xsl:when>
  90.                       <xsl:otherwise>
  91.                         <xsl:attribute name="width">50%</xsl:attribute>
  92.                         <xsl:attribute name="align">right</xsl:attribute>
  93.                         <xsl:attribute name="bgcolor">#EEEEEE</xsl:attribute>
  94.                       </xsl:otherwise>
  95.                     </xsl:choose>
  96.  
  97.                     <xsl:choose>
  98.                       <xsl:when test="@name">
  99.                         <xsl:value-of select="@name"/>
  100.                       </xsl:when>
  101.                       <xsl:otherwise>
  102.                         <xsl:value-of select="name()"/>
  103.                       </xsl:otherwise>
  104.                     </xsl:choose>
  105.                     <xsl:if test="text()">  </xsl:if>
  106.                   </td>
  107.                   <xsl:if test="text()"><td bgcolor="#DDDDDD">  <xsl:value-of select="text()"/></td></xsl:if></tr>
  108.  
  109.                   <xsl:for-each select="./*">
  110.                     <tr><td>
  111.                       <xsl:choose>
  112.                         <xsl:when test="not(text())">
  113.                           <xsl:attribute name="align">center</xsl:attribute>
  114.                           <xsl:attribute name="colspan">2</xsl:attribute>
  115.                           <xsl:attribute name="bgcolor">#F0F0F0</xsl:attribute>
  116.                           <br/>
  117.                         </xsl:when>
  118.                         <xsl:otherwise>
  119.                           <xsl:attribute name="width">50%</xsl:attribute>
  120.                           <xsl:attribute name="align">right</xsl:attribute>
  121.                           <xsl:attribute name="bgcolor">#DEDEDE</xsl:attribute>
  122.                         </xsl:otherwise>
  123.                       </xsl:choose>
  124.  
  125.                       <xsl:choose>
  126.                         <xsl:when test="@name">
  127.                           <xsl:value-of select="@name"/>
  128.                         </xsl:when>
  129.                         <xsl:otherwise>
  130.                           <xsl:value-of select="name()"/>
  131.                         </xsl:otherwise>
  132.                       </xsl:choose>
  133.                       <xsl:if test="text()">  </xsl:if>
  134.                     </td>
  135.  
  136.                     <xsl:if test="text()"><td bgcolor="#CDCDCD">  <xsl:value-of select="text()"/></td></xsl:if></tr>
  137.  
  138.                     <xsl:for-each select="./*">
  139.                       <tr><td align="right" bgcolor="#DEDEDE">
  140.                         <xsl:choose>
  141.                           <xsl:when test="@name">
  142.                             <xsl:value-of select="@name"/>
  143.                           </xsl:when>
  144.                           <xsl:otherwise>
  145.                             <xsl:value-of select="name()"/>
  146.                           </xsl:otherwise>
  147.                         </xsl:choose>
  148.                         <xsl:if test="text()">  </xsl:if>
  149.                       </td>
  150.                       <xsl:if test="text()"><td bgcolor="#CDCDCD">  <xsl:value-of select="text()"/></td></xsl:if></tr>
  151.  
  152.                       <xsl:if test="position()=last()"><tr><td bgcolor="#F0F0F0" colspan="2"><br/></td></tr></xsl:if>
  153.                     </xsl:for-each>
  154.                   </xsl:for-each>
  155.                   <xsl:if test="name()='Configuration'"><tr><td bgcolor="#F0F0F0" colspan="2"><hr noshade="true" color="#DADADA" width="50%"/></td></tr></xsl:if>
  156.                 </xsl:for-each>
  157.               </xsl:for-each>
  158.             </table><br/>
  159.           </xsl:for-each>
  160.         </xsl:otherwise>
  161.       </xsl:choose>
  162.     </xsl:for-each>
  163.   </xsl:template>
  164. </xsl:stylesheet>