Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/delibero.git

Fixed piechart in Chrome by assigning namespaces.

Author Dave Jarvis <email>
Date 2014-08-03 00:33:54 GMT-0700
Commit 68346d15e6317d849638028843068f251e454048
Parent aaaf9b3
xml/chart.xsl
<?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}"
xml/common.xsl
-<?xml version="1.0" encoding="UTF-8" ?>
+<?xml version="1.0"?>
<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="chart.xsl" />
<!-- Action parser that responds to HTTP requests. -->
<xsl:param name="action" select="'do.dhtml'" />
<xsl:template match="/">
-<html language="en">
+<html>
<head>
<meta charset="utf-8" />
<xsl:apply-templates mode="piechart" />
</div>
-</xsl:template>
-
-<xsl:template match="title" mode="piechart">
- <div class="title"><xsl:apply-templates /></div>
</xsl:template>
xml/math.xsl
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
xml/resources.xml
<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="common.xsl" ?>
+<?xml-stylesheet type="text/xsl" href="common.xsl"?>
<policy>
<summary>
Delta 14 lines added, 16 lines removed, 2-line decrease