OAI - resumption Token - xsl:iterate
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 12
- Joined: Wed Jan 16, 2019 6:49 pm
OAI - resumption Token - xsl:iterate
Hello!
I am processing data records from an OAI interface such as https://services.dnb.de/oai/repository? ... 2023-12-01 .
The individual record elements must be processed after a Catalog title is established.
At the end of the list is a resumptionToken, which can be used to call the next page of the result query. ( ) (https://www.dnb.de/EN/Professionell/Met ... 2_akk.html )
How can I use xsl:iterate to build a query that retrieves all pages with the new resumptionToken?
Here is a rough draft:
How can I iterate with the resumption tokens?
Thanks for your help!
I am processing data records from an OAI interface such as https://services.dnb.de/oai/repository? ... 2023-12-01 .
The individual record elements must be processed after a Catalog title is established.
At the end of the list is a resumptionToken, which can be used to call the next page of the result query. ( ) (https://www.dnb.de/EN/Professionell/Met ... 2_akk.html )
How can I use xsl:iterate to build a query that retrieves all pages with the new resumptionToken?
Here is a rough draft:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="3.0" xmlns:oai="http://www.openarchives.org/OAI/2.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*"/>
<xsl:output method="xml" indent="no" encoding="UTF-8"/>
<xsl:param name="param-uri-file-source" select="'https://services.dnb.de/oai/repository?verb=ListRecords&metadataPrefix=oai_dc'"/>
<xsl:variable name="file-source">
<xsl:choose>
<xsl:when test="doc-available($param-uri-file-source)">
<xsl:copy-of select="doc($param-uri-file-source)"/>
</xsl:when>
<xsl:when test="starts-with($param-uri-file-source,'http')">
<xsl:variable name="http">
<xsl:call-template name="get-file-from-interface">
<xsl:with-param name="uri-base-interface" select="$param-uri-file-source"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="doc-available($http)">
<xsl:copy-of select="doc($param-uri-file-source)"/>
</xsl:if>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:template match="/">
<xsl:result-document method="xml" indent="no" encoding="UTF-8">
<recordMetadata>
<Catalog>
<title>
<xsl:value-of select="'Catalog Title'"/>
</title>
</Catalog>
<!-- Iteration -->
<xsl:iterate select="$file-source/oai:OAI-PMH/oai:ListRecords">
<xsl:param name="param-resumptionToken"/>
<xsl:for-each select="oai:record">
<xsl:variable name="record" select="copy-of(.)"/>
<Titel>
<xsl:value-of select="$record/dc:title"/>
</Titel>
</xsl:for-each>
<xsl:if test="position() = last() and oai:resumptionToken != ''">
<xsl:next-iteration>
<xsl:with-param name="param-resumptionToken" select="oai:resumptionToken"/>
</xsl:next-iteration>
</xsl:if>
</xsl:iterate>
</recordMetadata>
</xsl:result-document>
</xsl:template>
Thanks for your help!
-
- Posts: 102
- Joined: Tue Aug 19, 2014 12:04 pm
Re: OAI - resumption Token - xsl:iterate
Post by Martin Honnen »
I would consider a recursive function e.g.
Then call e.g.
Code: Select all
<xsl:function name="mf:process-records" as="node()*">
<xsl:param name="recordList" as="element(oai:ListRecords)"/>
<xsl:for-each select="oai:record">
<xsl:variable name="record" select="copy-of(.)"/>
<Titel>
<xsl:value-of select="$record/dc:title"/>
</Titel>
</xsl:for-each>
<xsl:if test="oai:resumptionToken">
<xsl:sequence select="mf:process-records(doc($param-uri-file-source || '&resumptionToken=' || oai:resumptionToken)/oai:OAI-PMH/oai:ListRecords)"/>
</xsl:if>
</xsl:function>
Code: Select all
<xsl:sequence select="mf:process-records($file-source/oai:OAI-PMH/oai:ListRecords)"/>
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service