Remove CSS from the xsl file and the SVG generating code
This commit is contained in:
parent
9342ea63de
commit
4144d6b4ff
@ -17,7 +17,6 @@
|
|||||||
<xsl:variable name="r_aspect" select="240" />
|
<xsl:variable name="r_aspect" select="240" />
|
||||||
|
|
||||||
<xsl:template match="/">
|
<xsl:template match="/">
|
||||||
<xsl:processing-instruction name="xml-stylesheet">href="<xsl:value-of select="$css_file"/>" type="text/css"</xsl:processing-instruction>
|
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
@ -1010,11 +1010,7 @@ ag_chart_create_svg(AgChart *chart, gsize *length, GError **err)
|
|||||||
xmlNodePtr node = NULL;
|
xmlNodePtr node = NULL;
|
||||||
gchar *value;
|
gchar *value;
|
||||||
gchar *stylesheet_path;
|
gchar *stylesheet_path;
|
||||||
gchar *css_path;
|
|
||||||
gchar *save_content = NULL;
|
gchar *save_content = NULL;
|
||||||
gchar *css_uri;
|
|
||||||
gchar *css_final_uri;
|
|
||||||
gchar **params;
|
|
||||||
GList *houses;
|
GList *houses;
|
||||||
GList *house;
|
GList *house;
|
||||||
GList *planet;
|
GList *planet;
|
||||||
@ -1026,7 +1022,6 @@ ag_chart_create_svg(AgChart *chart, gsize *length, GError **err)
|
|||||||
GEnumClass *aspects_class;
|
GEnumClass *aspects_class;
|
||||||
GEnumClass *antiscia_class;
|
GEnumClass *antiscia_class;
|
||||||
gint save_length;
|
gint save_length;
|
||||||
GFile *css_file;
|
|
||||||
xsltStylesheetPtr xslt_proc;
|
xsltStylesheetPtr xslt_proc;
|
||||||
locale_t current_locale;
|
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
|
// 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");
|
stylesheet_path = g_strdup_printf("%s/%s", PKGDATADIR, "chart.xsl");
|
||||||
g_debug("Opening %s as a stylesheet", stylesheet_path);
|
g_debug("Opening %s as a stylesheet", stylesheet_path);
|
||||||
if ((xslt_doc = xmlReadFile(stylesheet_path, "UTF-8", 0)) == NULL) {
|
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
|
stylesheet_path
|
||||||
);
|
);
|
||||||
g_free(stylesheet_path);
|
g_free(stylesheet_path);
|
||||||
g_free(css_path);
|
|
||||||
g_free(css_uri);
|
|
||||||
g_object_unref(css_file);
|
|
||||||
xmlFreeDoc(doc);
|
xmlFreeDoc(doc);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1264,31 +1251,20 @@ ag_chart_create_svg(AgChart *chart, gsize *length, GError **err)
|
|||||||
stylesheet_path
|
stylesheet_path
|
||||||
);
|
);
|
||||||
g_free(stylesheet_path);
|
g_free(stylesheet_path);
|
||||||
g_free(css_path);
|
|
||||||
g_free(css_uri);
|
|
||||||
g_object_unref(css_file);
|
|
||||||
xmlFreeDoc(xslt_doc);
|
xmlFreeDoc(xslt_doc);
|
||||||
xmlFreeDoc(doc);
|
xmlFreeDoc(doc);
|
||||||
|
|
||||||
return NULL;
|
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
|
// 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
|
// 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
|
// character for decimal separator other than a dot. So let's just use the
|
||||||
// C locale until the SVG is generated.
|
// C locale until the SVG is generated.
|
||||||
current_locale = uselocale(newlocale(LC_ALL, "C", 0));
|
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);
|
uselocale(current_locale);
|
||||||
g_free(stylesheet_path);
|
g_free(stylesheet_path);
|
||||||
g_free(css_path);
|
|
||||||
g_object_unref(css_file);
|
|
||||||
g_free(params);
|
|
||||||
xsltFreeStylesheet(xslt_proc);
|
xsltFreeStylesheet(xslt_proc);
|
||||||
xmlFreeDoc(doc);
|
xmlFreeDoc(doc);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user