version working in oXygen, data.xml should be identical modulo whitespace; missing references: metadata.xml, text.rng
Change-Id: I93b755bedc5d9049725860c29f87abc1614078fa
diff --git a/nkjp2korap.xsl b/nkjp2korap.xsl
index 3feeac9..7ff28ad 100644
--- a/nkjp2korap.xsl
+++ b/nkjp2korap.xsl
@@ -1,25 +1,32 @@
<?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"
- version="3.0">
+ 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:template name="get-primary-data">
- <xsl:param name="corpusID"/>
- <xsl:param name="docID"/>
- <xsl:param name="textID"/>
-
- <xsl:document>
+ <!-- Template to create the data.xml file -->
+ <xsl:result-document encoding="UTF-8" method="xml" indent="yes"
+ href="{'test/output/' || $corpusID || '/' || $docID || '/' || $textID || '/data.xml'}">
<xsl:processing-instruction name="xml-model">href="text.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"</xsl:processing-instruction>
<xsl:element name="raw_text" namespace="http://ids-mannheim.de/ns/KorAP">
- <xsl:attribute name="docid">
- <xsl:value-of select="$corpusID" />_<xsl:value-of select="$docID" />.<xsl:value-of select="$textID" />
- </xsl:attribute>
- <metadata file="metadata.xml" />
- <text><xsl:value-of select="//*[local-name()='ab']" /></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:document>
+ </xsl:result-document>
+
</xsl:template>
</xsl:stylesheet>