projects
/
metaproxy-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d3786d0
)
query_rewrite: use config path to locate XSLT
author
Adam Dickmeiss
<adam@indexdata.dk>
Wed, 7 Mar 2012 14:01:40 +0000
(15:01 +0100)
committer
Adam Dickmeiss
<adam@indexdata.dk>
Wed, 7 Mar 2012 14:01:40 +0000
(15:01 +0100)
src/filter_query_rewrite.cpp
patch
|
blob
|
history
diff --git
a/src/filter_query_rewrite.cpp
b/src/filter_query_rewrite.cpp
index
6b2bfb9
..
f979ba4
100644
(file)
--- a/
src/filter_query_rewrite.cpp
+++ b/
src/filter_query_rewrite.cpp
@@
-28,6
+28,7
@@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <yaz/xmlquery.h>
#include <yaz/diagbib1.h>
#include <yaz/query-charset.h>
#include <yaz/xmlquery.h>
#include <yaz/diagbib1.h>
#include <yaz/query-charset.h>
+#include <yaz/tpath.h>
#include <libxslt/xsltutils.h>
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
#include <libxslt/transform.h>
@@
-42,7
+43,8
@@
namespace metaproxy_1 {
Rep();
~Rep();
void process(mp::Package &package) const;
Rep();
~Rep();
void process(mp::Package &package) const;
- void configure(const xmlNode * ptr);
+ void configure(const xmlNode * ptr, bool test_only,
+ const char *path);
private:
xsltStylesheetPtr m_stylesheet;
std::string charset_from;
private:
xsltStylesheetPtr m_stylesheet;
std::string charset_from;
@@
-69,15
+71,15
@@
yf::QueryRewrite::~QueryRewrite()
{ // must have a destructor because of boost::scoped_ptr
}
{ // must have a destructor because of boost::scoped_ptr
}
-void yf::QueryRewrite::process(mp::Package &package) const
+void mp::filter::QueryRewrite::configure(const xmlNode *ptr, bool test_only,
+ const char *path)
{
{
- m_p->process(package);
+ m_p->configure(ptr, test_only, path);
}
}
-void mp::filter::QueryRewrite::configure(const xmlNode *ptr, bool test_only,
- const char *path)
+void yf::QueryRewrite::process(mp::Package &package) const
{
{
- m_p->configure(ptr);
+ m_p->process(package);
}
void yf::QueryRewrite::Rep::process(mp::Package &package) const
}
void yf::QueryRewrite::Rep::process(mp::Package &package) const
@@
-154,7
+156,8
@@
void yf::QueryRewrite::Rep::process(mp::Package &package) const
package.move();
}
package.move();
}
-void mp::filter::QueryRewrite::Rep::configure(const xmlNode *ptr)
+void mp::filter::QueryRewrite::Rep::configure(const xmlNode *ptr,
+ bool test_only, const char *path)
{
for (ptr = ptr->children; ptr; ptr = ptr->next)
{
{
for (ptr = ptr->children; ptr; ptr = ptr->next)
{
@@
-169,7
+172,7
@@
void mp::filter::QueryRewrite::Rep::configure(const xmlNode *ptr)
("Only one xslt element allowed in query_rewrite filter");
}
("Only one xslt element allowed in query_rewrite filter");
}
- std::string fname;// = mp::xml::get_text(ptr);
+ std::string fname;
for (struct _xmlAttr *attr = ptr->properties;
attr; attr = attr->next)
for (struct _xmlAttr *attr = ptr->properties;
attr; attr = attr->next)
@@
-184,8
+187,15
@@
void mp::filter::QueryRewrite::Rep::configure(const xmlNode *ptr)
+ fname
+ "\"> needs XSLT stylesheet path content"
+ " in query_rewrite filter");
+ fname
+ "\"> needs XSLT stylesheet path content"
+ " in query_rewrite filter");
-
- m_stylesheet = xsltParseStylesheetFile(BAD_CAST fname.c_str());
+
+ char fullpath[1024];
+ char *cp = yaz_filepath_resolve(fname.c_str(), path, 0, fullpath);
+ if (!cp)
+ {
+ throw mp::filter::FilterException("Cannot read XSLT " + fname);
+ }
+
+ m_stylesheet = xsltParseStylesheetFile(BAD_CAST cp);
if (!m_stylesheet)
{
throw mp::filter::FilterException
if (!m_stylesheet)
{
throw mp::filter::FilterException