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 | f79443e | 2022-02-25 14:25:33 +0100 | [diff] [blame] | 4 | xmlns:f="func" xmlns:map="http://www.w3.org/2005/xpath-functions/map" |
| 5 | exclude-result-prefixes="xs f map" version="3.0" expand-text="yes"> |
Akron | 9a8ee3e | 2022-01-31 13:51:49 +0100 | [diff] [blame] | 6 | |
bansp | f79443e | 2022-02-25 14:25:33 +0100 | [diff] [blame] | 7 | <xsl:param name="corpusID"/> |
| 8 | <xsl:param name="docID"/> |
| 9 | <xsl:param name="textID"/> |
| 10 | <xsl:param name="targetDir" select="'test/resources/nkjp2korap_sample1/KOT/'"/> |
| 11 | <!-- the select is a fallback, so that it's clear to the reviewer what I'm passing in the param --> |
| 12 | |
| 13 | <xsl:template name="xsl:initial-template"> |
| 14 | |
| 15 | <xsl:variable name="text.xml" as="document-node()" select="doc($targetDir || 'text.xml')"/> |
Akron | 9a8ee3e | 2022-01-31 13:51:49 +0100 | [diff] [blame] | 16 | |
bansp | f79443e | 2022-02-25 14:25:33 +0100 | [diff] [blame] | 17 | <!-- Template to create the data.xml file --> |
bansp | 0748682 | 2022-02-25 14:33:13 +0100 | [diff] [blame^] | 18 | <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] | 19 | href="{'test/output/' || $corpusID || '/' || $docID || '/' || $textID || '/data.xml'}"> |
Akron | 9a8ee3e | 2022-01-31 13:51:49 +0100 | [diff] [blame] | 20 | <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^] | 21 | <xsl:element name="raw_text"> |
bansp | f79443e | 2022-02-25 14:25:33 +0100 | [diff] [blame] | 22 | <xsl:attribute name="docid" select="$corpusID || '_' || $docID || '.' || $textID"/> |
| 23 | <metadata file="metadata.xml"/> |
| 24 | <text> |
| 25 | <xsl:value-of select="$text.xml//*[local-name() = 'ab']"/> |
| 26 | </text> |
Akron | 9a8ee3e | 2022-01-31 13:51:49 +0100 | [diff] [blame] | 27 | </xsl:element> |
bansp | f79443e | 2022-02-25 14:25:33 +0100 | [diff] [blame] | 28 | </xsl:result-document> |
| 29 | |
Akron | 9a8ee3e | 2022-01-31 13:51:49 +0100 | [diff] [blame] | 30 | </xsl:template> |
| 31 | |
| 32 | </xsl:stylesheet> |