Akron | 9a8ee3e | 2022-01-31 13:51:49 +0100 | [diff] [blame] | 1 | <?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" |
bansp | 68529a8 | 2022-02-25 15:02:01 +0100 | [diff] [blame] | 4 | xmlns:nkjp="http://www.nkjp.pl/ns/1.0" |
| 5 | xmlns:tei="http://www.tei-c.org/ns/1.0" |
bansp | f79443e | 2022-02-25 14:25:33 +0100 | [diff] [blame] | 6 | xmlns:f="func" xmlns:map="http://www.w3.org/2005/xpath-functions/map" |
bansp | 68529a8 | 2022-02-25 15:02:01 +0100 | [diff] [blame] | 7 | exclude-result-prefixes="xs f map nkjp tei" version="3.0" expand-text="yes"> |
Akron | 9a8ee3e | 2022-01-31 13:51:49 +0100 | [diff] [blame] | 8 | |
bansp | f79443e | 2022-02-25 14:25:33 +0100 | [diff] [blame] | 9 | <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')"/> |
Akron | 9a8ee3e | 2022-01-31 13:51:49 +0100 | [diff] [blame] | 18 | |
bansp | f79443e | 2022-02-25 14:25:33 +0100 | [diff] [blame] | 19 | <!-- Template to create the data.xml file --> |
bansp | 0748682 | 2022-02-25 14:33:13 +0100 | [diff] [blame] | 20 | <xsl:result-document encoding="UTF-8" method="xml" indent="yes" xpath-default-namespace="http://ids-mannheim.de/ns/KorAP" |
bansp | f79443e | 2022-02-25 14:25:33 +0100 | [diff] [blame] | 21 | href="{'test/output/' || $corpusID || '/' || $docID || '/' || $textID || '/data.xml'}"> |
Akron | 9a8ee3e | 2022-01-31 13:51:49 +0100 | [diff] [blame] | 22 | <xsl:processing-instruction name="xml-model">href="text.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"</xsl:processing-instruction> |
bansp | 0748682 | 2022-02-25 14:33:13 +0100 | [diff] [blame] | 23 | <xsl:element name="raw_text"> |
bansp | f79443e | 2022-02-25 14:25:33 +0100 | [diff] [blame] | 24 | <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> |
Akron | 9a8ee3e | 2022-01-31 13:51:49 +0100 | [diff] [blame] | 29 | </xsl:element> |
bansp | f79443e | 2022-02-25 14:25:33 +0100 | [diff] [blame] | 30 | </xsl:result-document> |
bansp | 68529a8 | 2022-02-25 15:02:01 +0100 | [diff] [blame] | 31 | |
| 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> |
bansp | f79443e | 2022-02-25 14:25:33 +0100 | [diff] [blame] | 44 | |
Akron | 9a8ee3e | 2022-01-31 13:51:49 +0100 | [diff] [blame] | 45 | </xsl:template> |
| 46 | |
| 47 | </xsl:stylesheet> |