CMathMLFactoryXSLT::CMathMLFactoryXSLT(ALogger& l, const DOMX::XSLTStylesheet& s)
: AMathMLFactory(l), style(s)
-{
- reset();
-}
-
-void
-CMathMLFactoryXSLT::reset()
{
DOM::DOMImplementation di;
DOM::DocumentType dt;
void
CMathMLFactoryXSLT::documentModified(TDocument& doc)
{
- if (TNode dirty = doc.dirtyNode())
- {
- std::vector< std::pair<DOM::GdomeString, DOM::GdomeString> > dirtyId;
- if (result.get_documentElement().hasAttribute("xref"))
- dirtyId.push_back(std::make_pair(DOM::GdomeString("id"),
- DOM::GdomeString("'" + std::string(dirty["id"]) + "'")));
- DOM::Document res = style.apply(doc.document(), dirtyId);
- assert(res);
- style.save(doc.document(), stdout);
-
- DOM::Element root = res.get_documentElement();
- assert(root);
- assert(root.hasAttribute("xref"));
+ std::vector< std::pair<DOM::GdomeString, DOM::GdomeString> > dirtyId;
+ if (TNode dirty = doc.dirtyNode())
+ if (result.get_documentElement().hasAttribute("xref"))
+ dirtyId.push_back(std::make_pair(DOM::GdomeString("id"),
+ DOM::GdomeString("'" + std::string(dirty["id"]) + "'")));
+ DOM::Document res = style.apply(doc.document(), dirtyId);
+ assert(res);
+ style.save(doc.document(), stdout);
- if (result.get_documentElement().hasAttribute("xref"))
- {
- bool ok = subst(result.get_documentElement(), root.getAttribute("xref"), result.importNode(root, true));
- assert(ok);
- }
- else
- result.replaceChild(result.importNode(root, true), result.get_documentElement());
-
- style.save(result, stdout);
+ DOM::Element root = res.get_documentElement();
+ assert(root);
- doc.clearDirty();
+ if (result.get_documentElement().hasAttribute("xref"))
+ {
+ bool ok = subst(result.get_documentElement(), root.getAttribute("xref"), result.importNode(root, true));
+ assert(ok);
}
+ else
+ result.replaceChild(result.importNode(root, true), result.get_documentElement());
+
+ style.save(result, stdout);
+
+ doc.clearDirty();
}
bool