[PATCH 1/2] Skip XSL transformation for old Subsurface format

Miika Turkia miika.turkia at gmail.com
Thu Feb 7 11:20:02 PST 2013


Making sure the XSL transformation does not occur on Subsurface's old
XML format. A deeper inspection on the XML content is required as
MacDive and Subsurface (old format) have the same root element (dives).

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 parse-xml.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/parse-xml.c b/parse-xml.c
index 2bc68c6..9c9e2ab 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -1538,12 +1538,17 @@ xmlDoc *test_xslt_transforms(xmlDoc *doc)
 	xmlDoc *transformed;
 	xsltStylesheetPtr xslt = NULL;
 	xmlNode *root_element = xmlDocGetRootElement(doc);
+	char *attribute;
 
 	while ((info->root) && (strcasecmp(root_element->name, info->root) != 0)) {
 		info++;
 	}
 
 	if (info->root) {
+		attribute = xmlGetProp(xmlFirstElementChild(root_element), "name");
+		if (attribute && (strcasecmp(attribute, "subsurface") == 0))
+			return doc;
+
 		xmlSubstituteEntitiesDefault(1);
 		xslt = get_stylesheet(info->file);
 		if (xslt == NULL)
-- 
1.7.9.5



More information about the subsurface mailing list