This stylesheet transforms the XML board structure to HTML and makes it more readable. It displays the background image of the board and its fields in a graphical composition. Then it lists all interesting information.
<?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="board"> <html> <head> <title><xsl:value-of select="./@name"/></title> </head> <body> <h1><xsl:value-of select="./@name"/></h1> <div style="position:relative"> <img><xsl:attribute name="src"><xsl:value-of select="./@image"/></xsl:attribute></img> <xsl:for-each select="./field"> <div><xsl:attribute name="style">text-align:center; vertical-align:middle; border-style:solid; border-width:thin; position:absolute; left:<xsl:value-of select="./@l"/>px; top:<xsl:value-of select="./@t"/>px; width:<xsl:value-of select="./@w"/>px; height:<xsl:value-of select="./@h"/>px</xsl:attribute><xsl:value-of select="./@id"/></div> </xsl:for-each> </div> <h3>Fields</h3> <table border="1"> <tr><th>field</th><th>left</th><th>top</th><th>width</th><th>height</th></tr> <xsl:for-each select="./field"> <tr><td><xsl:value-of select="./@id"/></td><td><xsl:value-of select="./@l"/></td><td><xsl:value-of select="./@t"/></td><td><xsl:value-of select="./@w"/></td><td><xsl:value-of select="./@h"/></td></tr> </xsl:for-each> </table> <h3>Directions</h3> <ul> <xsl:for-each select="./dir"> <li><xsl:value-of select="./@id"/></li> </xsl:for-each> </ul> <h3>Permutations</h3> <xsl:for-each select="./perm"> <table border="1"> <tr><th colspan="2"><xsl:value-of select="./@id"/></th></tr> <tr><th>source</th><th>target</th></tr> <xsl:for-each select="./map"> <tr><td><xsl:value-of select="./@s"/></td><td><xsl:value-of select="./@t"/></td></tr> </xsl:for-each> </table> </xsl:for-each> <h3>Links</h3> <table border="1"> <tr><th>source</th><th>target</th><th>direction</th><th>permutation</th></tr> <xsl:for-each select="./field/link"> <tr> <td><xsl:value-of select="../@id"/></td> <td><xsl:value-of select="./@t"/></td> <td><xsl:value-of select="./@d"/></td> <td><xsl:value-of select="./@p"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>