Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. <?xml version="1.0"?>
  2.  
  3. <!--
  4.  
  5. Copyright 2008 Tungsten Graphics, Inc.
  6.  
  7. This program is free software: you can redistribute it and/or modify it
  8. under the terms of the GNU Lesser General Public License as published
  9. by the Free Software Foundation, either version 3 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU Lesser General Public License for more details.
  16.  
  17. You should have received a copy of the GNU Lesser General Public License
  18. along with this program.  If not, see <http://www.gnu.org/licenses/>.
  19.  
  20. !-->
  21.  
  22. <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  23.  
  24.         <xsl:output method="html" />
  25.  
  26.         <xsl:strip-space elements="*" />
  27.  
  28.         <xsl:template match="/trace">
  29.                 <html>
  30.                         <head>
  31.                                 <title>Gallium Trace</title>
  32.                         </head>
  33.                         <style>
  34.                                 body {
  35.                                         font-family: verdana, sans-serif;
  36.                                         font-size: 11px;
  37.                                         font-weight: normal;
  38.                                         text-align : left;
  39.                                 }
  40.  
  41.                                 .fun {
  42.                                         font-weight: bold;
  43.                                 }
  44.  
  45.                                 .var {
  46.                                         font-style: italic;
  47.                                 }
  48.  
  49.                                 .typ {
  50.                                         display: none;
  51.                                 }
  52.  
  53.                                 .lit {
  54.                                         color: #0000ff;
  55.                                 }
  56.  
  57.                                 .ptr {
  58.                                         color: #008000;
  59.                                 }
  60.                         </style>
  61.                         <body>
  62.                                 <ol class="calls">
  63.                                         <xsl:apply-templates/>
  64.                                 </ol>
  65.                         </body>
  66.                 </html>
  67.         </xsl:template>
  68.  
  69.         <xsl:template match="call">
  70.                 <li>
  71.                         <xsl:attribute name="value">
  72.                                 <xsl:apply-templates select="@no"/>
  73.                         </xsl:attribute>
  74.                         <span class="fun">
  75.                                 <xsl:value-of select="@class"/>
  76.                                 <xsl:text>::</xsl:text>
  77.                                 <xsl:value-of select="@method"/>
  78.                         </span>
  79.                         <xsl:text>(</xsl:text>
  80.                         <xsl:apply-templates select="arg"/>
  81.                         <xsl:text>)</xsl:text>
  82.                         <xsl:apply-templates select="ret"/>
  83.                 </li>
  84.         </xsl:template>
  85.  
  86.         <xsl:template match="arg|member">
  87.                         <xsl:apply-templates select="@name"/>
  88.                         <xsl:text> = </xsl:text>
  89.                         <xsl:apply-templates />
  90.                         <xsl:if test="position() != last()">
  91.                                 <xsl:text>, </xsl:text>
  92.                         </xsl:if>
  93.         </xsl:template>
  94.  
  95.         <xsl:template match="ret">
  96.                 <xsl:text> = </xsl:text>
  97.                 <xsl:apply-templates />
  98.         </xsl:template>
  99.  
  100.         <xsl:template match="bool|int|uint|float|enum">
  101.                 <span class="lit">
  102.                         <xsl:value-of select="text()"/>
  103.                 </span>
  104.         </xsl:template>
  105.  
  106.         <xsl:template match="bytes">
  107.                 <span class="lit">
  108.                         <xsl:text>...</xsl:text>
  109.                 </span>
  110.         </xsl:template>
  111.  
  112.         <xsl:template match="string">
  113.                 <span class="lit">
  114.                         <xsl:text>"</xsl:text>
  115.                         <xsl:call-template name="break">
  116.                                 <xsl:with-param name="text" select="text()"/>
  117.                         </xsl:call-template>
  118.                         <xsl:text>"</xsl:text>
  119.                 </span>
  120.         </xsl:template>
  121.  
  122.         <xsl:template match="array|struct">
  123.                 <xsl:text>{</xsl:text>
  124.                 <xsl:apply-templates />
  125.                 <xsl:text>}</xsl:text>
  126.         </xsl:template>
  127.  
  128.         <xsl:template match="elem">
  129.                 <xsl:apply-templates />
  130.                 <xsl:if test="position() != last()">
  131.                         <xsl:text>, </xsl:text>
  132.                 </xsl:if>
  133.         </xsl:template>
  134.  
  135.         <xsl:template match="null">
  136.                 <span class="ptr">
  137.                         <xsl:text>NULL</xsl:text>
  138.                 </span>
  139.         </xsl:template>
  140.  
  141.         <xsl:template match="ptr">
  142.                 <span class="ptr">
  143.                         <xsl:value-of select="text()"/>
  144.                 </span>
  145.         </xsl:template>
  146.  
  147.         <xsl:template match="@name">
  148.                 <span class="var">
  149.                         <xsl:value-of select="."/>
  150.                 </span>
  151.         </xsl:template>
  152.        
  153.         <xsl:template name="break">
  154.                 <xsl:param name="text" select="."/>
  155.                 <xsl:choose>
  156.                         <xsl:when test="contains($text, '&#xa;')">
  157.                                 <xsl:value-of select="substring-before($text, '&#xa;')"/>
  158.                                 <br/>
  159.                                 <xsl:call-template name="break">
  160.                                          <xsl:with-param name="text" select="substring-after($text, '&#xa;')"/>
  161.                                 </xsl:call-template>
  162.                         </xsl:when>
  163.                         <xsl:otherwise>
  164.                                 <xsl:value-of select="$text"/>
  165.                         </xsl:otherwise>
  166.                 </xsl:choose>
  167.         </xsl:template>
  168.  
  169.         <xsl:template name="replace">
  170.                 <xsl:param name="text"/>
  171.                 <xsl:param name="from"/>
  172.                 <xsl:param name="to"/>
  173.                 <xsl:choose>
  174.                         <xsl:when test="contains($text,$from)">
  175.                                 <xsl:value-of select="concat(substring-before($text,$from),$to)"/>
  176.                                 <xsl:call-template name="replace">
  177.                                         <xsl:with-param name="text" select="substring-after($text,$from)"/>
  178.                                         <xsl:with-param name="from" select="$from"/>
  179.                                         <xsl:with-param name="to" select="$to"/>
  180.                                 </xsl:call-template>
  181.                         </xsl:when>
  182.                         <xsl:otherwise>
  183.                                 <xsl:value-of select="$text"/>
  184.                         </xsl:otherwise>
  185.                 </xsl:choose>
  186.         </xsl:template>
  187.  
  188. </xsl:transform>
  189.