grim/purple-objects-docbook
Clone
Summary
Browse
Changes
Graph
show flags as flags in the diagram
2013-05-07, Gary Kramlich
2a53897c7904
show flags as flags in the diagram
<?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"
/>
<!-- variables -->
<xsl:variable
name=
"wrap-args-at"
select=
"2"
/>
<!-- the actual matching -->
<xsl:template
match=
"class"
>
<!-- start the diagram -->
<xsl:text
>
digraph
{
</xsl:text>
<xsl:value-of
select=
"$newline-tab"
/>
<!-- set our node settings -->
<xsl:text
>
node[fontname="sans",
fontsize="9",
shape="record",
style="filled",
fillcolor="lightyellow"];
</xsl:text>
<xsl:value-of
select=
"$newline-tab"
/>
<!-- handle the beginning of the class node -->
<xsl:text
>
class[label="{
</xsl:text>
<xsl:value-of
select=
"@name"
/>
<!-- check the class type and output it if it's there -->
<xsl:if
test=
"@type"
>
<xsl:text
>
\n\
<
\
<
</xsl:text>
<xsl:value-of
select=
"@type"
/>
<xsl:text
>
\
>
\
>
</xsl:text>
</xsl:if>
<xsl:text
>
|
</xsl:text>
<!-- run through the properties -->
<xsl:for-each
select=
"properties/property"
>
<xsl:call-template
name=
"scope"
/>
<!-- now the rest of the property -->
<xsl:text
>
</xsl:text>
<xsl:value-of
select=
"@name"
/>
<xsl:if
test=
"@type"
>
<xsl:text
>
:
</xsl:text>
<xsl:value-of
select=
"@type"
/>
</xsl:if>
<xsl:text
>
\l
</xsl:text>
</xsl:for-each>
<xsl:text
>
|
</xsl:text>
<!-- run through the methods -->
<xsl:for-each
select=
"methods/method"
>
<xsl:call-template
name=
"scope"
/>
<!-- start the method -->
<xsl:text
>
</xsl:text>
<xsl:value-of
select=
"@name"
/>
<!-- start the arguments -->
<xsl:text
>
(
</xsl:text>
<!-- run through the arguments -->
<xsl:for-each
select=
"argument"
>
<xsl:value-of
select=
"@name"
/>
<xsl:if
test=
"@type"
>
<xsl:text
>
:
</xsl:text>
<xsl:value-of
select=
"@type"
/>
</xsl:if>
<xsl:if
test=
"position() != last()"
>
<xsl:text
>
,
</xsl:text>
<xsl:choose
>
<xsl:when
test=
"position() mod $wrap-args-at = 0"
>
<xsl:text
>
\l
</xsl:text>
</xsl:when>
<xsl:otherwise
>
<xsl:text
>
</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>
<!-- finish the arguments -->
<xsl:text
>
)
</xsl:text>
<!-- if we have a type output it -->
<xsl:if
test=
"@type"
>
<xsl:text
>
:
</xsl:text>
<xsl:value-of
select=
"@type"
/>
</xsl:if>
<!-- left justify the line -->
<xsl:text
>
\l
</xsl:text>
</xsl:for-each>
<!-- finish off the class node -->
<xsl:text
>
}"];
</xsl:text>
<!-- finish up -->
<xsl:value-of
select=
"$newline"
/>
<xsl:text
>
}
</xsl:text>
<xsl:value-of
select=
"$newline"
/>
</xsl:template>
</xsl:stylesheet>