and takes the following content:
</para>
<variablelist>
- <varlistentry><term>attribute <literal>url</literal></term><listitem><para>
+ <varlistentry>
+ <term>attribute <literal>url</literal></term>
+ <listitem><para>
URL of Web service to be used to fetch target profile
for a given database (udb). The special sequence
<literal>%db</literal> of the URL is replaced by the
</para>
</listitem>
</varlistentry>
- <varlistentry><term>attribute <literal>xsldir</literal></term><listitem><para>
+ <varlistentry>
+ <term>attribute <literal>xsldir</literal></term>
+ <listitem><para>
Directory that is searched for XSL stylesheets. Stylesheets
are specified in the target profile by the
<literal>transform</literal> element.
</para>
</listitem>
</varlistentry>
- <varlistentry><term>element <literal>records</literal></term><listitem><para>
+ <varlistentry>
+ <term>attribute <literal>element_transform</literal></term>
+ <listitem><para>
+ Specifies the element that triggers retrieval and transform using
+ the parameters elementSet, recordEncoding, requestSyntax, transform
+ from the target profile. Default value
+ is "pz2", due to the fact that for historical reasons the
+ common format is that used in Pazpar2.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>attribute <literal>element_raw</literal></term>
+ <listitem><para>
+ Specifies an element that triggers retrieval using the
+ parameters elementSet, recordEncoding, requestSyntax from the
+ target profile. Same actions as for element_transform, but without
+ the XSL transform. Useful for debugging. The default value is "raw".
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>element <literal>records</literal></term>
+ <listitem><para>
Local target profiles. This element may includes zero or
more <literal>record</literal> elements (one per target
profile). See section TARGET PROFILE.
following content:
</para>
<variablelist>
- <varlistentry><term>attribute <literal>cql</literal></term><listitem><para>
- CQL field.
+ <varlistentry>
+ <term>attribute <literal>cql</literal></term>
+ <listitem>
+ <para>
+ CQL field that we are mapping "from".
</para>
</listitem>
</varlistentry>
- <varlistentry><term>attribute <literal>ccl</literal></term><listitem><para>
- CCL field.
+ <varlistentry>
+ <term>attribute <literal>ccl</literal></term>
+ <listitem>
+ <para>
+ CCL field that we are mapping "to".
</para>
</listitem>
</varlistentry>
<term>elementSet</term><listitem>
<para>
Specifies the elementSet to be sent to the target if record
- transform is enabled (not to be used with the record_transform
+ transform is enabled (not to be confused' with the record_transform
module). The record transform is enabled only if the client uses
- record syntax = XML and element set =
- <literal>pz2</literal>. If record transform is not enabled, this
- setting is not used and the element set specified by the client
+ record syntax = XML and a element set determined by
+ the <literal>element_transform</literal> /
+ <literal>element_raw</literal> from the configuration.
+ By default that is the element sets <literal>pz2</literal>
+ and <literal>raw</literal>.
+ If record transform is not enabled, this setting is
+ not used and the element set specified by the client
is passed verbatim.
</para>
</listitem>
<para>
Specifies a XSL stylesheet filename to be used if record
transform is anabled; see desciprion of elementSet.
+ The XSL transform is only used if the element set is set to the
+ value of <literal>element_transform</literal> in the configuration.
</para>
</listitem>
</varlistentry>
<torus
url="http://newmk2.indexdata.com/torus2/searchable.ebsco/records/?query=udb%3D%db"
xsldir="."
+ element_transform="pz"
+ element_raw="raw"
>
<records>
<record>
<retrievalinfo xmlns="http://indexdata.com/yaz" version="1.0">
<retrieval syntax="xml" name="usi">
<backend syntax="xml" name="pz2">
- <xslt stylesheet="../xml/xslt/pz22usi.xsl"/>
+ <xslt stylesheet="pz22usi.xsl"/>
</backend>
</retrieval>
<retrieval syntax="xml"/>
-Subproject commit f7d7eb4b44b7fdad1942e32856d6afc2e6dcabda
+Subproject commit c9c894a0b63f9ce9578570e3507c3e6232ec4797
std::map<std::string,std::string> fieldmap;
std::string xsldir;
CCL_bibset bibset;
+ std::string element_transform;
+ std::string element_raw;
std::map<std::string,SearchablePtr> s_map;
};
}
}
}
-yf::Zoom::Impl::Impl()
+yf::Zoom::Impl::Impl() : element_transform("pz2") , element_raw("raw")
{
bibset = ccl_qual_mk();
}
torus_url = mp::xml::get_text(attr->children);
else if (!strcmp((const char *) attr->name, "xsldir"))
xsldir = mp::xml::get_text(attr->children);
+ else if (!strcmp((const char *) attr->name, "element_transform"))
+ element_transform = mp::xml::get_text(attr->children);
+ else if (!strcmp((const char *) attr->name, "element_raw"))
+ element_raw = mp::xml::get_text(attr->children);
else
throw mp::filter::FilterException(
"Bad attribute " + std::string((const char *)
{
*number_of_records_returned = 0;
Z_Records *records = 0;
- bool enable_pz2_transform = false;
+ bool enable_pz2_retrieval = false; // whether target profile is used
+ bool enable_pz2_transform = false; // whether XSLT is used as well
if (start < 0 || number_to_present <= 0)
return records;
char oid_name_str[OID_STR_MAX];
const char *syntax_name = 0;
-
- if (preferredRecordSyntax)
+
+ if (preferredRecordSyntax &&
+ !oid_oidcmp(preferredRecordSyntax, yaz_oid_recsyn_xml)
+ && element_set_name)
{
- if (!oid_oidcmp(preferredRecordSyntax, yaz_oid_recsyn_xml)
- && element_set_name &&
- !strcmp(element_set_name, "pz2"))
+ if (!strcmp(element_set_name, m_p->element_transform.c_str()))
{
- if (b->sptr->request_syntax.length())
- syntax_name = b->sptr->request_syntax.c_str();
+ enable_pz2_retrieval = true;
enable_pz2_transform = true;
}
- else
+ else if (!strcmp(element_set_name, m_p->element_raw.c_str()))
{
- syntax_name =
- yaz_oid_to_string_buf(preferredRecordSyntax, 0, oid_name_str);
+ enable_pz2_retrieval = true;
}
}
+
+ if (enable_pz2_retrieval)
+ {
+ if (b->sptr->request_syntax.length())
+ syntax_name = b->sptr->request_syntax.c_str();
+ }
+ else if (preferredRecordSyntax)
+ syntax_name =
+ yaz_oid_to_string_buf(preferredRecordSyntax, 0, oid_name_str);
b->set_option("preferredRecordSyntax", syntax_name);
- if (enable_pz2_transform)
+ if (enable_pz2_retrieval)
{
element_set_name = 0;
if (b->sptr->element_set.length())
npr = zget_surrogateDiagRec(odr, odr_database, sur_error,
addinfo);
}
- else if (enable_pz2_transform)
+ else if (enable_pz2_retrieval)
{
char rec_type_str[100];
int rec_len;
const char *rec_buf = ZOOM_record_get(recs[i], rec_type_str,
&rec_len);
- if (rec_buf && b->xsp)
+ if (rec_buf && b->xsp && enable_pz2_transform)
{
xmlDoc *rec_doc = xmlParseMemory(rec_buf, rec_len);
if (rec_doc)
element mp:torus {
attribute url { xsd:string },
attribute xsldir { xsd:string }?,
+ attribute element_transform { xsd:string }?,
+ attribute element_raw { xsd:string }?,
element mp:records {
element mp:record {
element mp:authentication { xsd:string }?,
</attribute>
</optional>
<optional>
+ <attribute name="element_transform">
+ <data type="string"/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="element_raw">
+ <data type="string"/>
+ </attribute>
+ </optional>
+ <optional>
<element name="mp:records">
<zeroOrMore>
<element name="mp:record">
</xs:sequence>
<xs:attribute name="url" use="required" type="xs:string"/>
<xs:attribute name="xsldir" type="xs:string"/>
+ <xs:attribute name="element_transform" type="xs:string"/>
+ <xs:attribute name="element_raw" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="records">