blob: 2a946157d0dd54c57edf907b0d18a89a30827d85 [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"
banspf79443e2022-02-25 14:25:33 +01004 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">
Akron9a8ee3e2022-01-31 13:51:49 +01006
banspf79443e2022-02-25 14:25:33 +01007 <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')"/>
Akron9a8ee3e2022-01-31 13:51:49 +010016
banspf79443e2022-02-25 14:25:33 +010017 <!-- Template to create the data.xml file -->
bansp07486822022-02-25 14:33:13 +010018 <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 +010019 href="{'test/output/' || $corpusID || '/' || $docID || '/' || $textID || '/data.xml'}">
Akron9a8ee3e2022-01-31 13:51:49 +010020 <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 +010021 <xsl:element name="raw_text">
banspf79443e2022-02-25 14:25:33 +010022 <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>
Akron9a8ee3e2022-01-31 13:51:49 +010027 </xsl:element>
banspf79443e2022-02-25 14:25:33 +010028 </xsl:result-document>
29
Akron9a8ee3e2022-01-31 13:51:49 +010030 </xsl:template>
31
32</xsl:stylesheet>