Skip to content

Instantly share code, notes, and snippets.

@stoerr
Created September 29, 2014 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stoerr/fe404637d2b7676650d0 to your computer and use it in GitHub Desktop.
Save stoerr/fe404637d2b7676650d0 to your computer and use it in GitHub Desktop.
Makes graph of tiles 1 definition extensions in dotty / graphviz format
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:output method="text" />
<xsl:template match="/" >
<xsl:text>digraph tilesdefs {
ranksep="2";
</xsl:text>
<xsl:for-each select="/tiles-definitions/definition[@extends]">
"<xsl:value-of select="@name"/>" -> "<xsl:value-of select="@extends"/>" ;
</xsl:for-each>
<xsl:for-each select="/tiles-definitions/definition/put[starts-with(@value,'.')]">
"<xsl:value-of select="../@name"/>" -> "<xsl:value-of select="@value"/>" [style="dashed", label="<xsl:value-of select="@name"/>"] ;
</xsl:for-each>
<xsl:text>
}</xsl:text>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment