Remove CSS from the xsl file and the SVG generating code

This commit is contained in:
Gergely Polonkai 2014-07-11 14:32:24 +02:00
parent 9342ea63de
commit 4144d6b4ff
2 changed files with 1 additions and 26 deletions

View File

@ -17,7 +17,6 @@
<xsl:variable name="r_aspect" select="240" />
<xsl:template match="/">
<xsl:processing-instruction name="xml-stylesheet">href="<xsl:value-of select="$css_file"/>" type="text/css"</xsl:processing-instruction>
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"

View File

@ -1010,11 +1010,7 @@ ag_chart_create_svg(AgChart *chart, gsize *length, GError **err)
xmlNodePtr node = NULL;
gchar *value;
gchar *stylesheet_path;
gchar *css_path;
gchar *save_content = NULL;
gchar *css_uri;
gchar *css_final_uri;
gchar **params;
GList *houses;
GList *house;
GList *planet;
@ -1026,7 +1022,6 @@ ag_chart_create_svg(AgChart *chart, gsize *length, GError **err)
GEnumClass *aspects_class;
GEnumClass *antiscia_class;
gint save_length;
GFile *css_file;
xsltStylesheetPtr xslt_proc;
locale_t current_locale;
@ -1227,11 +1222,6 @@ ag_chart_create_svg(AgChart *chart, gsize *length, GError **err)
// Now, doc contains the generated XML tree
css_path = g_strdup_printf("%s/%s", PKGDATADIR, "chart.css");
g_debug("Using %s as a CSS stylesheet", css_path);
css_file = g_file_new_for_path(css_path);
css_uri = g_file_get_uri(css_file);
stylesheet_path = g_strdup_printf("%s/%s", PKGDATADIR, "chart.xsl");
g_debug("Opening %s as a stylesheet", stylesheet_path);
if ((xslt_doc = xmlReadFile(stylesheet_path, "UTF-8", 0)) == NULL) {
@ -1242,9 +1232,6 @@ ag_chart_create_svg(AgChart *chart, gsize *length, GError **err)
stylesheet_path
);
g_free(stylesheet_path);
g_free(css_path);
g_free(css_uri);
g_object_unref(css_file);
xmlFreeDoc(doc);
return NULL;
@ -1264,31 +1251,20 @@ ag_chart_create_svg(AgChart *chart, gsize *length, GError **err)
stylesheet_path
);
g_free(stylesheet_path);
g_free(css_path);
g_free(css_uri);
g_object_unref(css_file);
xmlFreeDoc(xslt_doc);
xmlFreeDoc(doc);
return NULL;
}
css_final_uri = g_strdup_printf("'%s'", css_uri);
g_free(css_uri);
params = g_new0(gchar *, 3);
params[0] = "css_file";
params[1] = css_final_uri;
// libxml2 messes up the output, as it prints decimal floating point
// numbers in a localized format. It is not good in locales that use a
// character for decimal separator other than a dot. So let's just use the
// C locale until the SVG is generated.
current_locale = uselocale(newlocale(LC_ALL, "C", 0));
svg_doc = xsltApplyStylesheet(xslt_proc, doc, (const char **)params);
svg_doc = xsltApplyStylesheet(xslt_proc, doc, NULL);
uselocale(current_locale);
g_free(stylesheet_path);
g_free(css_path);
g_object_unref(css_file);
g_free(params);
xsltFreeStylesheet(xslt_proc);
xmlFreeDoc(doc);