blob: 2a946157d0dd54c57edf907b0d18a89a30827d85 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:f="func" xmlns:map="http://www.w3.org/2005/xpath-functions/map"
exclude-result-prefixes="xs f map" version="3.0" expand-text="yes">
<xsl:param name="corpusID"/>
<xsl:param name="docID"/>
<xsl:param name="textID"/>
<xsl:param name="targetDir" select="'test/resources/nkjp2korap_sample1/KOT/'"/>
<!-- the select is a fallback, so that it's clear to the reviewer what I'm passing in the param -->
<xsl:template name="xsl:initial-template">
<xsl:variable name="text.xml" as="document-node()" select="doc($targetDir || 'text.xml')"/>
<!-- Template to create the data.xml file -->
<xsl:result-document encoding="UTF-8" method="xml" indent="yes" xpath-default-namespace="http://ids-mannheim.de/ns/KorAP"
href="{'test/output/' || $corpusID || '/' || $docID || '/' || $textID || '/data.xml'}">
<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>
<xsl:element name="raw_text">
<xsl:attribute name="docid" select="$corpusID || '_' || $docID || '.' || $textID"/>
<metadata file="metadata.xml"/>
<text>
<xsl:value-of select="$text.xml//*[local-name() = 'ab']"/>
</text>
</xsl:element>
</xsl:result-document>
</xsl:template>
</xsl:stylesheet>