+ for (ptr = ptr->children; ptr; ptr = ptr->next)
+ {
+ if (ptr->type != XML_ELEMENT_NODE)
+ continue;
+
+ if (mp::xml::check_element_mp(ptr, "xslt"))
+ {
+ if (m_stylesheet)
+ {
+ throw mp::filter::FilterException
+ ("Only one xslt element allowed in query_rewrite filter");
+ }
+
+ std::string fname;// = mp::xml::get_text(ptr);
+
+ for (struct _xmlAttr *attr = ptr->properties;
+ attr; attr = attr->next)
+ {
+ mp::xml::check_attribute(attr, "", "stylesheet");
+ fname = mp::xml::get_text(attr);
+ }
+
+ if (0 == fname.size())
+ throw mp::filter::FilterException
+ ("Attribute <xslt stylesheet=\""
+ + fname
+ + "\"> needs XSLT stylesheet path content"
+ + " in query_rewrite filter");
+
+ m_stylesheet = xsltParseStylesheetFile(BAD_CAST fname.c_str());
+ if (!m_stylesheet)
+ {
+ throw mp::filter::FilterException
+ ("Failed to read XSLT stylesheet '"
+ + fname
+ + "' in query_rewrite filter");
+ }
+ }
+ else
+ {
+ throw mp::filter::FilterException
+ ("Bad element "
+ + std::string((const char *) ptr->name)
+ + " in query_rewrite filter");
+ }
+ }
+}
+
+static mp::filter::Base* filter_creator()
+{
+ return new mp::filter::QueryRewrite;