home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2005 February / PCpro_2005_02.ISO / files / opensource / Dia_0.94 / dia-setup-0.94.exe / dia-uml2componentlist.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2003-08-22  |  2.1 KB  |  60 lines

  1. <?xml version="1.0"?>
  2. <!-- 
  3.      Generate a grouped list of dia UML components 
  4.  
  5.      Copyright(c) 2003 Steffen Macke <sdteffen@web.de>
  6.  
  7.      This program is free software; you can redistribute it and/or modify
  8.      it under the terms of the GNU General Public License as published by
  9.      the Free Software Foundation; either version 2 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 General Public License for more details.
  16.      
  17.      You should have received a copy of the GNU General Public License
  18.      along with this program; if not, write to the Free Software
  19.      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20.  
  21. -->
  22.  
  23. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  24.   version="1.0">
  25.   <xsl:output method="xml"/> 
  26.   <xsl:key name="component-by-text" match="component" use="."/>
  27.   <xsl:key name="component-by-stereotype" match="component" use="@stereotype" />
  28.   <xsl:template match="/dia-uml">
  29.   <html>
  30.     <head><title>Component List</title></head>
  31.     <body>
  32.       <h1>Component List</h1>
  33.       <table border="1">
  34.         <tr>
  35.       <th>Stereotype</th>
  36.       <th>Component</th>
  37.       <th>Count</th>
  38.     </tr>
  39.     <xsl:for-each select=
  40.       "component[count(.|key('component-by-stereotype',@stereotype)[1])=1]">
  41.       <xsl:sort select="@stereotype" />
  42.       <xsl:variable name="stereotype"><xsl:value-of select="@stereotype" 
  43.         /></xsl:variable>
  44.       <xsl:for-each select=
  45.       "../component[@stereotype=$stereotype and (count(. | key('component-by-text', .)[1]) = 1)]">
  46.         <xsl:sort select="text()" />
  47.         <tr>
  48.           <td><xsl:value-of select="$stereotype" /></td>
  49.           <td><xsl:value-of select="." /></td>
  50.           <td><xsl:value-of select="count(key('component-by-text', .))" />
  51.           </td>
  52.         </tr>
  53.       </xsl:for-each>
  54.     </xsl:for-each>
  55.       </table>
  56.     </body>
  57.   </html>
  58.   </xsl:template>
  59. </xsl:stylesheet>
  60.