Skip to content

Instantly share code, notes, and snippets.

@bohdanszymanik
Created December 4, 2013 02:42
Show Gist options
  • Save bohdanszymanik/7781450 to your computer and use it in GitHub Desktop.
Save bohdanszymanik/7781450 to your computer and use it in GitHub Desktop.
Take a SCOM management pack and transform it to DGML to display as a graph inside visual studio. Helps to visualise your system definition models.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://schemas.microsoft.com/vs/2009/dgml" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<DirectedGraph>
<Nodes>
<xsl:apply-templates select="ManagementPack/TypeDefinitions/EntityTypes/ClassTypes/ClassType" />
</Nodes>
<Links>
<xsl:apply-templates select="ManagementPack/TypeDefinitions/EntityTypes/RelationshipTypes/RelationshipType" />
</Links>
<Categories>
</Categories>
<Properties>
<Property Id="Accessibility" Label ="Accessibility" Description="Accessibility" DataType="System.String" />
<Property Id="Abstract" Label="Abstract" Description="Whether this is an abstract class" DataType="System.Boolean" />
<Property Id="Base" Label="Base" Description="Whether this is a base class" DataType="System.String"/>
<Property Id="Hosted" Label="Hosted" Description="Whether this is hosted" DataType="System.Boolean"/>
<Property Id="Singleton" Label="Singleton" Description="Whether this is singleton" DataType="System.Boolean"/>
</Properties>
</DirectedGraph>
</xsl:template>
<xsl:template match="ManagementPack/TypeDefinitions/EntityTypes/ClassTypes/ClassType">
<xsl:element name="Node">
<xsl:attribute name="Id">
<xsl:value-of select="@ID"/>
</xsl:attribute>
<xsl:attribute name="Accessibility">
<xsl:value-of select="@Accessibility"/>
</xsl:attribute>
<xsl:attribute name="Abstract">
<xsl:value-of select="@Abstract"/>
</xsl:attribute>
<xsl:attribute name="Base">
<xsl:value-of select="@Base"/>
</xsl:attribute>
<xsl:attribute name="Hosted">
<xsl:value-of select="@Hosted"/>
</xsl:attribute>
<xsl:attribute name="Singleton">
<xsl:value-of select="@Singleton"/>
</xsl:attribute>
</xsl:element>
</xsl:template>
<xsl:template match="ManagementPack/TypeDefinitions/EntityTypes/RelationshipTypes/RelationshipType">
<Link>
<xsl:attribute name="Source">
<xsl:value-of select="Source"/>
</xsl:attribute>
<xsl:attribute name="Target">
<xsl:value-of select="Target"/>
</xsl:attribute>
</Link>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment