grim/purple-objects-docbook

added a bit to the about page

2013-06-01, Gary Kramlich
cd5a1edb9dd5
added a bit to the about page
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="common.xsl"/>
<xsl:variable name="abstract-color" select="'palegreen'"/>
<xsl:variable name="concrete-color" select="'lightpink'"/>
<xsl:variable name="interface-color" select="'powderblue'"/>
<xsl:variable name="boxed-color" select="'lightyellow'"/>
<!-- relation templates -->
<xsl:template name="relation.is-a">
<xsl:text>[arrowhead="onormal"];</xsl:text>
</xsl:template>
<xsl:template name="relation.has-a">
<xsl:text>[arrowhead="odiamond"];</xsl:text>
</xsl:template>
<xsl:template name="relation.implements">
<xsl:text>[arrowhead="odot"];</xsl:text>
</xsl:template>
<xsl:template name="relation.default">
<xsl:text>[arrowhead="normal"];</xsl:text>
</xsl:template>
<!-- object template -->
<xsl:template name="object">
<xsl:value-of select="@name"/>
<xsl:text>[</xsl:text>
<xsl:if test="@label">
<xsl:text>label="</xsl:text>
<xsl:value-of select="@label"/>
<xsl:text>"</xsl:text>
<xsl:if test="@type">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:if>
<xsl:if test="@type">
<xsl:text>fillcolor="</xsl:text>
<xsl:choose>
<xsl:when test="@type = 'abstract'">
<xsl:value-of select="$abstract-color"/>
</xsl:when>
<xsl:when test="@type = 'concrete'">
<xsl:value-of select="$concrete-color"/>
</xsl:when>
<xsl:when test="@type = 'interface'">
<xsl:value-of select="$interface-color"/>
</xsl:when>
<xsl:when test="@type = 'boxed'">
<xsl:value-of select="$boxed-color"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>wtf</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>"</xsl:text>
</xsl:if>
<xsl:text>];</xsl:text>
<xsl:value-of select="$newline-tab"/>
</xsl:template>
<!-- relation template -->
<xsl:template name="relation">
<xsl:value-of select="@start"/>
<xsl:text> -&gt; </xsl:text>
<xsl:value-of select="@end"/>
<xsl:if test="@type">
<xsl:choose>
<xsl:when test="@type = 'is-a'">
<xsl:call-template name="relation.is-a"/>
</xsl:when>
<xsl:when test="@type = 'has-a'">
<xsl:call-template name="relation.has-a"/>
</xsl:when>
<xsl:when test="@type = 'implements'">
<xsl:call-template name="relation.implements"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="relation.default"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:value-of select="$newline-tab"/>
</xsl:template>
<!-- main template -->
<xsl:template match="hierarchy">
<!-- start the diagram -->
<xsl:text>digraph {</xsl:text>
<xsl:value-of select="$newline-tab"/>
<!-- output some basic stuff -->
<!-- don't set a label if we don't have one -->
<xsl:if test="@name">
<xsl:text>label="</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>";</xsl:text>
<xsl:value-of select="$newline-tab"/>
<xsl:text>labelloc="t";</xsl:text>
<xsl:value-of select="$newline-tab"/>
</xsl:if>
<xsl:text>splines=true;</xsl:text>
<xsl:value-of select="$newline-tab"/>
<xsl:text>overlap=false;</xsl:text>
<xsl:value-of select="$newline-tab"/>
<xsl:text>rankdir="tb";</xsl:text>
<xsl:value-of select="$newline"/>
<xsl:value-of select="$newline-tab"/>
<!-- set our global node settings -->
<xsl:text>node[fontname="sans", fontsize="9", shape="rect", style="filled"];</xsl:text>
<xsl:value-of select="$newline"/>
<xsl:value-of select="$newline-tab"/>
<!-- run through our objects -->
<xsl:for-each select="objects/object">
<xsl:call-template name="object"/>
</xsl:for-each>
<xsl:value-of select="$newline-tab"/>
<!-- run through our relations -->
<xsl:for-each select="relations/relation">
<xsl:call-template name="relation"/>
</xsl:for-each>
<!-- finish up -->
<xsl:value-of select="$newline"/>
<xsl:text>}</xsl:text>
<xsl:value-of select="$newline"/>
</xsl:template>
</xsl:stylesheet>