diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2014-12-31 22:09:34 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-12-31 12:12:20 -0800 |
commit | 5d68c7d4a19ca56405bc039808e7262eb3b18510 (patch) | |
tree | 84817aa58d7f8d7916e627102e87dc3ee821970e /save-xml.c | |
parent | c1d9055948b319a2f918e1115fae13619dda3f5e (diff) | |
download | subsurface-5d68c7d4a19ca56405bc039808e7262eb3b18510.tar.gz |
Use unit selection for XSL transformation on CSV export
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'save-xml.c')
-rw-r--r-- | save-xml.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/save-xml.c b/save-xml.c index 9172032ee..7317446f7 100644 --- a/save-xml.c +++ b/save-xml.c @@ -638,7 +638,7 @@ int save_dives_logic(const char *filename, const bool select_only) return error; } -int export_dives_xslt(const char *filename, const bool selected, const char *export_xslt) +int export_dives_xslt(const char *filename, const bool selected, const int units, const char *export_xslt) { FILE *f; struct membuffer buf = { 0 }; @@ -646,6 +646,9 @@ int export_dives_xslt(const char *filename, const bool selected, const char *exp xsltStylesheetPtr xslt = NULL; xmlDoc *transformed; int res = 0; + char *params[3]; + int pnr = 0; + char unitstr[3]; if (verbose) fprintf(stderr, "export_dives_xslt with stylesheet %s\n", export_xslt); @@ -671,7 +674,12 @@ int export_dives_xslt(const char *filename, const bool selected, const char *exp if (!xslt) return report_error("Failed to open export conversion stylesheet"); - transformed = xsltApplyStylesheet(xslt, doc, NULL); + snprintf(unitstr, 3, "%d", units); + params[pnr++] = "units"; + params[pnr++] = unitstr; + params[pnr++] = NULL; + + transformed = xsltApplyStylesheet(xslt, doc, (const char **)params); xmlFreeDoc(doc); /* Write the transformed export to file */ |