Skip to content

Instantly share code, notes, and snippets.

@michalradacz
Last active February 18, 2020 20:11
Show Gist options
  • Save michalradacz/0af9d5a342569c18c502522fea612b14 to your computer and use it in GitHub Desktop.
Save michalradacz/0af9d5a342569c18c502522fea612b14 to your computer and use it in GitHub Desktop.
XSLT schéma generování tabulkové dokumentace z archimate modelu
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<style>
body {
font-family: "Helvetica Neue", "Open Sans", Arial, sans-serif;
}
table {
font-size: 15px;
line-height: 1.3em;
}
table.border {
border-collapse: collapse;
border-spacing: 0;
}
td {
padding: 5px;
min-width: 100px;
}
td.border {
border: 1px solid black;
padding: 4px;
}
</style>
<body>
<i>Výpis dokumentace z modelu architektury</i>
<h1><xsl:value-of select="model/name"/></h1>
<p><xsl:value-of select="model/documentation"/></p>
<h2>Elementy modelu</h2>
<table class="border">
<tr style="text-align:left;">
<th>Element</th>
<th>Popis</th>
<th>Typ</th>
</tr>
<xsl:for-each select="model/elements/element">
<xsl:sort select="@type"/>
<tr>
<td class="border"><xsl:value-of select="name"/></td>
<td class="border"><xsl:value-of select="documentation"/></td>
<td class="border"><xsl:value-of select="@type"/></td>
</tr>
</xsl:for-each>
</table>
<h2>Vazby modelu</h2>
<table class="border">
<tr style="text-align:left;">
<th>Z</th>
<th>Význam</th>
<th>Na</th>
<th>Popis</th>
</tr>
<xsl:for-each select="model/relationships/relationship">
<xsl:sort select="@type"/>
<xsl:variable name="Source" select="concat('',@source,'')"></xsl:variable>
<xsl:variable name="Target" select="concat('',@target,'')"></xsl:variable>
<tr>
<td class="border"><xsl:value-of select="//element[@identifier=$Source]/name"/></td>
<td class="border"><xsl:value-of select="name"/></td>
<td class="border"><xsl:value-of select="//element[@identifier=$Target]/name"/></td>
<td class="border"><xsl:value-of select="documentation"/></td>
</tr>
</xsl:for-each>
</table>
<hr></hr><i>Vygenerováno pomocí nástroje Archimrd z modulu Archimrd archimate plugin</i>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
@michalradacz
Copy link
Author

Read me

Toto XSLT schéma slouží pro vygenerování jednoduché tabulkové dokumentace z AEX (Archimate exchange XML format) souboru XML.

Vygeneruje nejprve úvod dokumentu s názvem a popisem modelu a poté dvě tabulky, v první jsou všechny elementy a ve druhé jsou všechny vazby. U objektů a vazeb jsou popisky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment