How to create XSLT for OAI-PMH response?

Skip to first unread message

Asatur Vardanyan

Jun 28, 2021, 10:30:19 AM6/28/21
Hi. I have a response like this:
<?xml version="1.0" encoding="UTF-8"?>
<OAI-PMH xmlns="" xmlns:xsi="" xsi:schemaLocation="">
<request verb="ListRecords" metadataPrefix="oai_dc" set="p15869coll19" from="2020-09-01" until="2020-09-30"></request>
<oai_dc:dc xmlns:oai_dc="" xmlns:dc="" xmlns:xsi="" xsi:schemaLocation="">
<dc:title>Papers of Abraham C. Ratshesky</dc:title>
<dc:subject>Halifax Explosion, Halifax, N.S. 1917; Massachusetts, General Court. Senate; American Red Cross. Boston Metropolitan Chapter</dc:subject>
<dc:description>Photographs; Morse Family</dc:description>
<dc:rights>Open access</dc:rights>
<dc:rights>User has an obligation to determine copyright or other use restrictions prior to publication or distribution. Please contact the archives at or 617-226-1245 for more information.</dc:rights>
<dc:source>Wyner Family Jewish Heritage Center, New England Historic Genealogical Society</dc:source>

Is it available to generate an XSL file for this response?

John Salter

Jun 29, 2021, 4:19:24 AM6/29/21

Hi Asatur,

It looks like your system uses the CONTENTdm platform. I'm not sure if there is a way to specify an XSLT to be included in the output of that platform, but the vendor may be able to assist.


If you want to apply an XSLT manually to the response, there is a widely used example here: which will render the oai_dc metadata profile.

The XSLT has to be saved locally (relative to where you are accessing the XML from), and can be included e.g.:

<?xml version='1.0' encoding='UTF-8'?>

<?xml-stylesheet type='text/xsl' href='/oai2.xsl' ?>




Hope that helps,



You received this message because you are subscribed to the Google Groups "OAI-PMH" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Asatur Vardanyan

Jun 29, 2021, 5:05:11 AM6/29/21
Thank you. I have some resources about my problem.
Here my XML response.

Here XSLT for the above XML

<?xml version="1.0" encoding="UTF-8" ?>
        exclude-result-prefixes="oai_dc dc">

    <xsl:output method="xml" doctype-public="XSLT-compat" omit-xml-declaration="yes" encoding="UTF-8" indent="yes"/>

    <xsl:template match="/">
            <xsl:for-each select="OAI-PMH/ListRecords/record">
                    <field name="id">
                        <xsl:value-of select="header/identifier"/>
                    <field name="tcngrams_title">
                        <xsl:value-of select="metadata/oai_dc:dc/dc:title"/>
                    <field name="tcngrams_content">
                                select="string-join((metadata/oai_dc:dc/dc:description, metadata/oai_dc:dc/dc:subject,  metadata/oai_dc:dc/dc:coverage), ' ')"/>
                    <field name="sm_url">
                        <xsl:variable name="delimeter">
                        <xsl:for-each select="metadata/oai_dc:dc/dc:identifier">
                                <xsl:when test="starts-with(., 'http://')">
                                    <xsl:value-of select="replace(., 'http://', 'https://')"/>
                                    <xsl:value-of select="$delimeter"/>
                                    <xsl:if test="starts-with(., 'https://')">
                                        <xsl:value-of select="."/>
                                        <xsl:value-of select="$delimeter"/>

                    <field name="ds_date_created">
                        <xsl:value-of select="concat(header/datestamp,'T00:00:00Z')"/>
                    <field name="ds_date_updated">
                        <xsl:value-of select="concat(header/datestamp,'T00:00:00Z')"/>
                    <xsl:if test="metadata/oai_dc:dc/dc:type">
                        <field name="ss_category">
                            <xsl:value-of select="metadata/oai_dc:dc/dc:type"/>
                    <field name="ss_topic">
                        <xsl:for-each select="metadata/oai_dc:dc/dc:subject">
                            <xsl:variable name="subject" select="normalize-space(substring-before(.,'--'))"/>

                                <xsl:when test="$subject">
                                    <xsl:value-of select="$subject"/>
                                    <xsl:value-of select="normalize-space(.)"/>
                    <xsl:if test="metadata/oai_dc:dc/dc:creator">
                        <field name="tcngrams_author_name">
                            <xsl:value-of select="metadata/oai_dc:dc/dc:creator"/>
                    <field name="sm_source">
                                select="string-join((metadata/oai_dc:dc/dc:source, metadata/oai_dc:dc/dc:relation), ' ')"/>



I missed this line exclude-result-prefixes="oai_dc dc".  So the translator could not understand what is oai_dc and dc.

2021 թ. հունիսի 29, երեքշաբթի-ին ժամը 12:19:24 UTC+4-ին օգտատերը գրել է․
Reply all
Reply to author
0 new messages