Signed-off-by: Miika Turkia <[email protected]>
---
 dive.h                        |  2 +-
 qt-ui/divelogexportdialog.cpp |  2 +-
 save-xml.c                    | 12 ++++++++++--
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/dive.h b/dive.h
index 6821a84..5906d05 100644
--- a/dive.h
+++ b/dive.h
@@ -638,7 +638,7 @@ extern int parse_manual_file(const char *filename, int 
separator_index, int unit
 extern int save_dives(const char *filename);
 extern int save_dives_logic(const char *filename, bool select_only);
 extern int save_dive(FILE *f, struct dive *dive);
-extern int export_dives_xslt(const char *filename, const bool selected, const 
char *export_xslt);
+extern int export_dives_xslt(const char *filename, const bool selected, const 
int units, const char *export_xslt);
 
 struct git_oid;
 struct git_repository;
diff --git a/qt-ui/divelogexportdialog.cpp b/qt-ui/divelogexportdialog.cpp
index d168ebe..8f5d720 100644
--- a/qt-ui/divelogexportdialog.cpp
+++ b/qt-ui/divelogexportdialog.cpp
@@ -318,7 +318,7 @@ void DiveLogExportDialog::on_buttonBox_accepted()
                settings.endGroup();
                // the non XSLT exports are called directly above, the XSLT 
based ons are called here
                if (!stylesheet.isEmpty())
-                       export_dives_xslt(filename.toUtf8(), 
ui->exportSelected->isChecked(), stylesheet.toUtf8());
+                       export_dives_xslt(filename.toUtf8(), 
ui->exportSelected->isChecked(), ui->CSVUnits_2->currentIndex(), 
stylesheet.toUtf8());
        }
 }
 
diff --git a/save-xml.c b/save-xml.c
index 9172032..7317446 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 */
-- 
1.9.1

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to