home *** CD-ROM | disk | FTP | other *** search
- <xsl:stylesheet
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version="1.0"
- xmlns="http://www.w3.org/1999/xhtml" xmlns:dia="http://www.lysator.liu.se/~alla/dia">
- <!-- converts data from (uncompressed) dia UML file to an HTML file -->
- <!-- requires an XLST processor -->
- <xsl:template
- match="/dia:diagram">
- <html>
- <head>
- <title>UML</title>
-
- <style type="text/css">
- .header {color: black; font-family: Arial, helvetica,
- sans-serif;}
- .headerhighlight { color: red; font-family: Arial,
- Helvetica, san-serif;}
- .details {font-family: Arial, Helvetica, sans-serif;
- background-color: white; color: black;}
- .datatype {font-family: Courier; color: #555555; }
- .description {font-family: Courier; color: black;
- margin-left: 5pt;}
-
- </style>
-
- <script language="JavaScript1.2" src="ua.js"></script>
-
- <script type="text/javascript"
- language="JavaScript1.2">
-
- function toggleHighlight(block, id) {
- if(navigator.family=="ie4") {
- var theElement = block.children[0];
- theElement.className = theElement.className=="headerhighlight"?"header":"headerhighlight";
-
- }
- if(navigator.family=="gecko") {
- document.getElementById(id).firstChild.className = document.getElementById(id).firstChild.className=="headerhighlight"?"header":"headerhighlight";
- }
- };
-
- function toggleVisibility(block, id) {
- if((navigator.family=="gecko")||((navigator.family="ie4"))) {
- var childNodes = document.getElementById(id).childNodes;
- if(navigator.family=="gecko") {
- var start=2;
- }
- else {
- var start=1;
- }
- for(var i=start; i!= childNodes.length; i++) {
- if(!childNodes.item(i).style) {
- }
- else {
- childNodes.item(i).style.display = childNodes.item(i).style.display=='none'?'block':'none';
- }
- }
- }
- };
-
- </script>
- </head>
-
- <body
- text="#000000"
- bgcolor="#FFFFFF"
- link="#FF0000"
- alink="#FF0000"
- vlink="#FF0000">
- <h1
- class="header">UML</h1>
-
- <xsl:for-each
- select="dia:layer">
- <xsl:if test="./@name!='Legend'">
- <xsl:for-each select="dia:object">
- <xsl:sort select="dia:attribute/dia:string/text()" lang="en" data-type="text"/>
- <xsl:if
- test="./@type='UML - Class'">
- <xsl:element name="div">
- <xsl:attribute name="class">header</xsl:attribute>
- <xsl:attribute name="onmouseover">toggleHighlight(this,'<xsl:value-of select="@id"/>')</xsl:attribute>
- <xsl:attribute name="onmouseout">toggleHighlight(this,'<xsl:value-of select="@id"/>')</xsl:attribute>
- <xsl:attribute name="onclick">toggleVisibility(this,'<xsl:value-of select="@id"/>')</xsl:attribute>
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
- <xsl:for-each
- select="dia:attribute">
- <xsl:if
- test="./@name='name'">
- <h2>
- <xsl:element
- name="a">
- <xsl:attribute
- name="name">
- <xsl:value-of
- select="../@id" />
- </xsl:attribute>
-
- <xsl:value-of
- select="substring(dia:string/text(),2, string-length(dia:string/text())-2)" />
-
- </xsl:element>
- </h2>
- </xsl:if>
-
- <xsl:if
- test="./@name='attributes'">
- <xsl:variable
- name="classid"
- select="../@id" />
-
- <xsl:for-each
- select="../../dia:object">
- <xsl:if
- test="./@type='UML - Generalization'">
- <xsl:if
- test="dia:connections/dia:connection[2]/@to = $classid">
-
- <xsl:variable
- name="parentid"
- select="dia:connections/dia:connection[1]/@to" />
-
- <xsl:for-each
- select="../dia:object">
- <xsl:if
- test="./@type='UML - Class'">
- <xsl:if
- test="./@id = $parentid">
- <div
- style="display='none'">Inherits from
-
- <xsl:for-each
- select="dia:attribute">
- <xsl:if
- test="./@name='name'">
- <xsl:element
- name="a">
- <xsl:attribute
- name="href">#<xsl:value-of
- select="$parentid" />
- </xsl:attribute><xsl:value-of
- select="substring(dia:string/text(),2,string-length(dia:string/text())-2)" />
- </xsl:element>
- </xsl:if>
- </xsl:for-each>
- </div>
- </xsl:if>
- </xsl:if>
- </xsl:for-each>
- </xsl:if>
- </xsl:if>
-
- <xsl:if
- test="./@type='UML - Generalization'">
- <xsl:if
- test="dia:connections/dia:connection[1]/@to = $classid">
-
- <xsl:variable
- name="childid"
- select="dia:connections/dia:connection[2]/@to" />
-
- <xsl:for-each
- select="../dia:object">
- <xsl:if
- test="./@type='UML - Class'">
- <xsl:if
- test="./@id = $childid">
- <div
- style="display='none'">Inherited by
- <xsl:for-each
- select="dia:attribute">
-
- <xsl:if
- test="./@name='name'">
- <xsl:element
- name="a">
- <xsl:attribute
- name="href">#<xsl:value-of
- select="$childid" />
- </xsl:attribute><xsl:value-of
- select="substring(dia:string/text(),2,string-length(dia:string/text())-2)" />
- </xsl:element>
- </xsl:if>
- </xsl:for-each>
- </div>
- </xsl:if>
- </xsl:if>
- </xsl:for-each>
- </xsl:if>
- </xsl:if>
-
-
- <xsl:if test="./@type='UML - Realizes'">
- <xsl:if test="dia:connections/dia:connection[1]/@to = $classid">
- <xsl:variable
- name="childid"
- select="dia:connections/dia:connection[2]/@to" />
-
- <xsl:for-each
- select="../dia:object">
- <xsl:if
- test="./@type='UML - Object'">
- <xsl:if
- test="./@id = $childid">
-
-
- <xsl:for-each select="dia:attribute">
- <xsl:if test="./@name='exstate'">
- <xsl:choose>
- <xsl:when test="dia:string/text()='#private#'"></xsl:when>
- <xsl:otherwise>
- <div style="display='none'">Subtype
- <xsl:for-each
- select="../dia:attribute/dia:composite/dia:attribute">
- <xsl:if
- test="./@name='string'">
- <xsl:if test="dia:string/text()!='##'">
- <b><xsl:value-of
- select="substring(dia:string/text(),2,string-length(dia:string/text())-2)" /></b>
- <span
- class="description">TODO: Add
- description of
- <xsl:value-of
- select="substring(dia:string/text(),2, string-length(dia:string/text())-2)" />
- here.</span>
- </xsl:if>
- </xsl:if>
- </xsl:for-each>
- </div>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:for-each>
-
- </xsl:if>
- </xsl:if>
- </xsl:for-each>
- </xsl:if>
- </xsl:if>
-
- </xsl:for-each>
-
- <div
- class="details"
- style="display='none'">
- <ul>
- <xsl:for-each
- select="dia:composite">
- <li>
- <xsl:for-each
- select="dia:attribute">
- <xsl:if
- test="./@name='name'">
- <xsl:value-of
- select="substring(dia:string/text(),2, string-length(dia:string/text())-2)" />
- </xsl:if>
- </xsl:for-each>
-
- <xsl:text>: </xsl:text>
- <xsl:for-each
- select="dia:attribute">
- <xsl:if
- test="./@name='type'">
- <i>
- <span
- class="datatype">
- <xsl:value-of
- select="substring(dia:string/text(),2, string-length(dia:string/text())-2)" />
- </span>
- </i>
-
- <xsl:for-each
- select="../dia:attribute">
- <xsl:if
- test="./@name='name'">
- <span
- class="description">TODO: Add
- description of
- <xsl:value-of
- select="substring(dia:string/text(),2, string-length(dia:string/text())-2)" />
-
- here.</span>
- </xsl:if>
- </xsl:for-each>
- </xsl:if>
- </xsl:for-each>
- </li>
- </xsl:for-each>
- </ul>
- </div>
- </xsl:if>
- </xsl:for-each>
- </xsl:element><!-- class header -->
- </xsl:if>
- </xsl:for-each>
- </xsl:if>
- </xsl:for-each>
- </body>
- <script language="JavaScript1.2" src="ua.js"></script><script type="text/javascript" language="JavaScript1.2">
- if(navigator.family=="gecko") {
- var nodeList = document.getElementsByTagName("div");
- for(var i=1; i!= nodeList.length; i++) {
- if(nodeList.item(i).getAttribute("id")!="") {
- toggleVisibility("test", nodeList.item(i).getAttribute("id"));
- }
- }
- }
- </script>
- </html>
- </xsl:template>
- </xsl:stylesheet>
-