home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 February / PCWorld_2007-02_cd.bin / temacd / vbuzzer / Vbuzzer_Setup_2.0.282.exe / MessageLog.xsl < prev    next >
Extensible Markup Language  |  2006-05-31  |  12KB  |  187 lines

  1.  ■<?xml version="1.0"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3. <!-- localized strings -->
  4. <xsl:variable name='ColumnHeader_Date'>Date</xsl:variable>
  5. <xsl:variable name='ColumnHeader_Time'>Time</xsl:variable>
  6. <xsl:variable name='ColumnHeader_From'>From</xsl:variable>
  7. <xsl:variable name='ColumnHeader_To'>To</xsl:variable>
  8. <xsl:variable name='ColumnHeader_Message'>Message</xsl:variable>
  9. <!-- variables -->
  10. <xsl:variable name='Debug'>0</xsl:variable>
  11. <xsl:variable name='TableStyle'>font-family:Verdana; font-size:67%; text-align:left; vertical-align:top; table-layout:fixed</xsl:variable>
  12. <xsl:variable name='GutterStyle'>width:2ex</xsl:variable>
  13. <xsl:variable name='HeaderStyle'>border-bottom:1 solid black</xsl:variable>
  14. <xsl:variable name='UseZebraStripe'>1</xsl:variable>
  15. <xsl:variable name='ZebraStripeStyle'>background-color:#e0edff</xsl:variable>
  16. <xsl:variable name='MostRecentSessionFirst'>0</xsl:variable>
  17. <xsl:template match="Log">
  18.     <html dir='ltr'>
  19.     <head>
  20.         <title>
  21.             Message Log for <xsl:value-of select="@LogonName"/>
  22.             <xsl:if test="$Debug = 1"> (Debug)</xsl:if>
  23.         </title>
  24.         <xsl:if test="$Debug = 1">
  25.             <span style="font-family:trebuchet ms; font-size:120%">
  26.                 Debug Version
  27.             </span>
  28.             <hr/>
  29.         </xsl:if>
  30.     </head>
  31.     <body style='margin:0'>
  32.         <table id='BodyTable' style="{$TableStyle}" cellspacing='0'>
  33.             <xsl:if test="$Debug = 1">
  34.                 <col style="vertical-align:top; width:5ex;"/>
  35.                 <col style='{$GutterStyle}' />
  36.             </xsl:if>
  37.             <col style="width:16ex;"/>
  38.             <col style='{$GutterStyle}' />
  39.             <col style="width:16ex;"/>
  40.             <col style='{$GutterStyle}' />
  41.             <col style="width:21ex;"/>
  42.             <col style='{$GutterStyle}' />
  43.             <col style="width:21ex;"/>
  44.             <col style='{$GutterStyle}' />
  45.             <col style="width:70ex;"/>
  46.             <thead>
  47.                 <tr>
  48.                     <xsl:if test="$Debug = 1">
  49.                         <th style="{$HeaderStyle}">SID</th>
  50.                         <th/>
  51.                     </xsl:if>
  52.                     <th style="{$HeaderStyle}">
  53.                         <xsl:value-of select="$ColumnHeader_Date"/>
  54.                     </th>
  55.                     <th/>
  56.                     <th style="{$HeaderStyle}">
  57.                         <xsl:value-of select="$ColumnHeader_Time"/>
  58.                     </th>
  59.                     <th/>
  60.                     <th style="{$HeaderStyle}">
  61.                         <xsl:value-of select="$ColumnHeader_From"/>
  62.                     </th>
  63.                     <th/>
  64.                     <th style="{$HeaderStyle}">
  65.                         <xsl:value-of select="$ColumnHeader_To"/>
  66.                     </th>
  67.                     <th/>
  68.                     <th style="{$HeaderStyle}">
  69.                         <xsl:value-of select="$ColumnHeader_Message"/>
  70.                     </th>
  71.                 </tr>
  72.             </thead>
  73.             <tbody style='vertical-align:top'>
  74.                 <xsl:choose>
  75.                     <!-- newest session first -->
  76.                     <xsl:when test="$MostRecentSessionFirst = 1">
  77.                         <xsl:apply-templates>
  78.                             <xsl:sort select='@SessionID' order='descending' data-type='number'/>
  79.                             <xsl:sort select='@DateTime'  order='ascending'/>
  80.                         </xsl:apply-templates>
  81.                     </xsl:when>
  82.                     <!-- oldest session first -->
  83.                     <xsl:otherwise>
  84.                         <xsl:apply-templates>
  85.                             <xsl:sort select='@SessionID' order='ascending' data-type='number'/>
  86.                             <xsl:sort select='@DateTime'  order='ascending'/>
  87.                         </xsl:apply-templates>
  88.                     </xsl:otherwise>
  89.                 </xsl:choose>
  90.             </tbody>
  91.         </table>
  92.     </body>
  93.     </html>
  94. </xsl:template>
  95. <xsl:template match="Message">
  96.     <tr>
  97.         <xsl:call-template name="CommonMessageProcessing" />
  98.         <td> <xsl:apply-templates select="From/User"/> </td>
  99.         <td/>
  100.         <td> <xsl:apply-templates select="To/User"/> </td>
  101.         <td/>
  102.         <td>
  103.             <span>
  104.                 <xsl:attribute name="style">
  105.                     <xsl:value-of select="Text/@Style"/>
  106.                 </xsl:attribute>
  107.                 <xsl:value-of select="Text"/>
  108.             </span>
  109.         </td>
  110.     </tr>
  111. </xsl:template>
  112. <xsl:template match="Invitation|InvitationResponse|Join|Leave">
  113.     <tr>
  114.         <xsl:call-template name="CommonMessageProcessing" />
  115.         <td/>  <!-- From -->
  116.         <td/>
  117.         <td/>  <!-- To -->
  118.         <td/>
  119.         <td>
  120.             <span>
  121.                 <xsl:attribute name="style">
  122.                     <xsl:value-of select="Text/@Style"/>
  123.                 </xsl:attribute>
  124.                 <xsl:value-of select="Text"/>
  125.             </span>
  126.         </td>
  127.     </tr>
  128. </xsl:template>
  129. <xsl:template match="User">
  130.     <!-- add a comma before all but the first user -->
  131.     <xsl:if test="position() != 1">, </xsl:if>
  132.     <xsl:value-of select="@FriendlyName"/>
  133. </xsl:template>
  134. <xsl:template name="CommonMessageProcessing">
  135.     <!-- zebra-stripe the sessions -->
  136.     <xsl:if test="$UseZebraStripe = 1">
  137.         <xsl:if test="(@SessionID mod 2) = 1">
  138.             <xsl:attribute name="style">
  139.                 <xsl:value-of select="$ZebraStripeStyle"/>
  140.             </xsl:attribute>
  141.         </xsl:if>
  142.     </xsl:if>
  143.     <xsl:if test="$Debug = 1">
  144.         <td> <xsl:value-of select="@SessionID"/> </td>
  145.         <td/>
  146.     </xsl:if>
  147.     <td> <xsl:value-of select="@Date"/> </td>
  148.     <td/>
  149.     <td> <xsl:value-of select="@Time"/> </td>
  150.     <td/>
  151. </xsl:template>
  152. </xsl:stylesheet>