attribute type { "xquery" },
attribute id { xsd:NCName }?,
attribute name { xsd:NCName }?,
+ element mp:elementset {
+ attribute name { xsd:string },
+ attribute backend { xsd:string },
+ },
element mp:script {
attribute name { xsd:string },
},
<para>
Configurable values:
<variablelist>
- <varlistentry><term><script name="name"></term>
+ <varlistentry><term><elementset name="name1" backend="name2"/></term>
+ <listitem>
+ <para>
+ Specifies the elementset (name1) that triggers the transform.
+ Note that the record syntax must be XML as well.
+ The 2nd element set, name2, specifies the element set that
+ is sent to the next filter in chain (backend).
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry><term><script name="name"/></term>
<listitem>
<para>
The full path of the XQuery script to be invoked.
</para>
</listitem>
</varlistentry>
- <varlistentry><term><record name="var"></term>
+ <varlistentry><term><record name="var"/></term>
<listitem>
<para>
The name of the XQUery variable where the input XML record
<refsect1><title>EXAMPLES</title>
<para>
- Configuration:
+ Configuration for converting MARCXML to BIBFRAME.
<screen><![CDATA[
- <filter type="session_shared">
- <resultset ttl="10" max="3" restart="true"/>
- <session ttl="30" max="100"/>
+ <filter type="xquery">
+ <elementset name="bibframe" backend="marcxml"/>
+ <script name="/usr/share/marc2bibframe/xbin/zorba3-0.xqy"/>
+ <record name="marcxmluri"/>
+ <variable name="serialization" value="rdxml"/>
+ <variable name="baseuri" value="http://base/"/>
</filter>
]]>
</screen>
<category access="false" line="true" apdu="false" />
</filter>
<filter type="xquery">
+ <elementset name="bibframe" backend="marcxml"/>
<script name="/home/adam/proj/marc2bibframe/xbin/zorba3-0.xqy"/>
<record name="marcxmluri"/>
<variable name="serialization" value="rdxml"/>
std::string zorba_filename;
std::string zorba_script;
std::string zorba_record_variable;
+ std::string elementset_input;
+ std::string elementset_output;
Zorba *lZorba;
XQuery_t lQuery;
};
const char *backend_schema = 0;
const Odr_oid *backend_syntax = 0;
- if (input_schema && !strcmp(input_schema, "bibframe") &&
+ if (input_schema && !strcmp(input_schema, elementset_input.c_str()) &&
(!input_syntax || !oid_oidcmp(input_syntax, yaz_oid_recsyn_xml)))
{
- backend_schema = "marcxml";
+ backend_schema = elementset_output.c_str();
backend_syntax = yaz_oid_recsyn_xml;
}
else
{
if (ptr->type != XML_ELEMENT_NODE)
continue;
- if (!strcmp((const char *) ptr->name, "variable"))
+ if (!strcmp((const char *) ptr->name, "elementset"))
+ {
+ struct _xmlAttr *attr;
+ for (attr = ptr->properties; attr; attr = attr->next)
+ if (!strcmp((const char *) attr->name, "name"))
+ elementset_input = mp::xml::get_text(attr->children);
+ else if (!strcmp((const char *) attr->name, "backend"))
+ elementset_output = mp::xml::get_text(attr->children);
+ else
+ throw mp::filter::FilterException(
+ "Bad attribute " + std::string((const char *)
+ attr->name));
+ }
+ else if (!strcmp((const char *) ptr->name, "variable"))
{
std::string name;
std::string value;