blob: 5b19e00faf3c60abc293e1ef0ef6a9c93169c358 [file] [log] [blame]
Akron9a8ee3e2022-01-31 13:51:49 +01001<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:xs="http://www.w3.org/2001/XMLSchema"
bansp68529a82022-02-25 15:02:01 +01004 xmlns:nkjp="http://www.nkjp.pl/ns/1.0"
5 xmlns:tei="http://www.tei-c.org/ns/1.0"
banspf79443e2022-02-25 14:25:33 +01006 xmlns:f="func" xmlns:map="http://www.w3.org/2005/xpath-functions/map"
bansp68529a82022-02-25 15:02:01 +01007 exclude-result-prefixes="xs f map nkjp tei" version="3.0" expand-text="yes">
Akron9a8ee3e2022-01-31 13:51:49 +01008
banspf79443e2022-02-25 14:25:33 +01009 <xsl:param name="corpusID"/>
10 <xsl:param name="docID"/>
11 <xsl:param name="textID"/>
12 <xsl:param name="targetDir" select="'test/resources/nkjp2korap_sample1/KOT/'"/>
13 <!-- the select is a fallback, so that it's clear to the reviewer what I'm passing in the param -->
14
15 <xsl:template name="xsl:initial-template">
16
17 <xsl:variable name="text.xml" as="document-node()" select="doc($targetDir || 'text.xml')"/>
Akron9a8ee3e2022-01-31 13:51:49 +010018
banspf79443e2022-02-25 14:25:33 +010019 <!-- Template to create the data.xml file -->
bansp07486822022-02-25 14:33:13 +010020 <xsl:result-document encoding="UTF-8" method="xml" indent="yes" xpath-default-namespace="http://ids-mannheim.de/ns/KorAP"
banspf79443e2022-02-25 14:25:33 +010021 href="{'test/output/' || $corpusID || '/' || $docID || '/' || $textID || '/data.xml'}">
Akron9a8ee3e2022-01-31 13:51:49 +010022 <xsl:processing-instruction name="xml-model">href=&quot;text.rng&quot; type=&quot;application/xml&quot; schematypens=&quot;http://relaxng.org/ns/structure/1.0&quot;</xsl:processing-instruction>
bansp07486822022-02-25 14:33:13 +010023 <xsl:element name="raw_text">
banspf79443e2022-02-25 14:25:33 +010024 <xsl:attribute name="docid" select="$corpusID || '_' || $docID || '.' || $textID"/>
25 <metadata file="metadata.xml"/>
26 <text>
27 <xsl:value-of select="$text.xml//*[local-name() = 'ab']"/>
28 </text>
Akron9a8ee3e2022-01-31 13:51:49 +010029 </xsl:element>
banspf79443e2022-02-25 14:25:33 +010030 </xsl:result-document>
bansp68529a82022-02-25 15:02:01 +010031
32 <xsl:result-document encoding="UTF-8" method="xml" indent="yes" xpath-default-namespace="http://ids-mannheim.de/ns/KorAP"
33 href="{'test/output/' || $corpusID || '/' || $docID || '/' || $textID || '/header.xml'}"
34 doctype-public="-//IDS//DTD IDS-XCES 1.0//EN" doctype-system="http://corpora.ids-mannheim.de/idsxces1/DTD/ids.xcesdoc.dtd">
35
36 <idsHeader type="document" pattern="text" status="new" version="1.1" TEIform="teiHeader">
37 <xsl:copy-of select="$text.xml//tei:TEI/tei:teiHeader/tei:fileDesc"/>
38 </idsHeader>
39
40 <xsl:copy>
41
42 </xsl:copy>
43 </xsl:result-document>
banspf79443e2022-02-25 14:25:33 +010044
Akron9a8ee3e2022-01-31 13:51:49 +010045 </xsl:template>
46
47</xsl:stylesheet>