| | <?xml version="1.0" encoding="UTF-8"?> |
| | <xsl:stylesheet version="1.0" |
| | - xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| | - xmlns:svg="http://www.w3.org/2000/svg"> |
| | + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
| | |
| | <xsl:include href="math.xsl" /> |
| | |
| | <xsl:variable name="base_colour" select="'46A5E5'" /> |
| | <xsl:variable name="stroke_colour" select="'white'" /> |
| | <xsl:variable name="width" select="200" /> |
| | <xsl:variable name="height" select="$width" /> |
| | + |
| | + <xsl:template match="title" mode="piechart"> |
| | + <div class="title"><xsl:apply-templates /></div> |
| | + </xsl:template> |
| | |
| | <!-- Convert XML data into a pie chart. --> |
| | <xsl:template match="dataset" mode="piechart"> |
| | |
| | <!-- Number of pie pieces. --> |
| | <xsl:variable name="pieces" select="count(data)" /> |
| | |
| | <!-- Calculate the total value for all pieces (for percentages). --> |
| | <xsl:variable name="total" select="sum(//value)" /> |
| | - |
| | + |
| | <div class="chart"> |
| | <div class="graph"> |
| | - <svg:svg width="30%" height="30%" viewBox="0 0 {$width} {$height}" version="1.1"> |
| | + <svg width="{$width}" height="{$height}" version="1.1" xmlns="http://www.w3.org/2000/svg"> |
| | <xsl:for-each select="data"> |
| | <xsl:apply-templates select="value" mode="piechart"> |
 |
| | </xsl:apply-templates> |
| | </xsl:for-each> |
| | - </svg:svg> |
| | + </svg> |
| | </div> |
| | <!-- SVG 1.1 has no text flow abilities: legend is plain HTML. --> |
 |
| | </xsl:variable> |
| | |
| | - <svg:path |
| | + <path xmlns="http://www.w3.org/2000/svg" |
| | fill="{$colour}" |
| | title="{$title}" |