Skip XSL transformation for old Subsurface format

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@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Miika Turkia 2013-02-07 21:20:02 +02:00 committed by Dirk Hohndel
parent cee75b0f49
commit 3150c1a6e8

View file

@ -1538,12 +1538,17 @@ xmlDoc *test_xslt_transforms(xmlDoc *doc)
xmlDoc *transformed; xmlDoc *transformed;
xsltStylesheetPtr xslt = NULL; xsltStylesheetPtr xslt = NULL;
xmlNode *root_element = xmlDocGetRootElement(doc); xmlNode *root_element = xmlDocGetRootElement(doc);
char *attribute;
while ((info->root) && (strcasecmp(root_element->name, info->root) != 0)) { while ((info->root) && (strcasecmp(root_element->name, info->root) != 0)) {
info++; info++;
} }
if (info->root) { if (info->root) {
attribute = xmlGetProp(xmlFirstElementChild(root_element), "name");
if (attribute && (strcasecmp(attribute, "subsurface") == 0))
return doc;
xmlSubstituteEntitiesDefault(1); xmlSubstituteEntitiesDefault(1);
xslt = get_stylesheet(info->file); xslt = get_stylesheet(info->file);
if (xslt == NULL) if (xslt == NULL)