Merge "Added primary data file as conversion target"
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2c3fc27
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+/test/xspec/
+/todo.org
+\#*
+.*
+!.gitignore
+!.github
diff --git a/Readme.md b/Readme.md
index d6cf9c6..6dec606 100644
--- a/Readme.md
+++ b/Readme.md
@@ -4,6 +4,18 @@
## Installation
+The test suite is based on [xspec](https://xspec.io/). To install xspec,
+please follow the [Installation Guide](https://github.com/xspec/xspec/wiki).
+Ensure either `xspec.bat` or `xspec.sh` is available on the command line.
+
+To run the test suite, execute
+
+```shell
+$ xspec.sh test/nkjp2korap.xspec
+```
+
+The created report is available in `test/xspec/nkjp2korap-result.html` afterwards.
+
## Examples Usage
## Development and License
diff --git a/nkjp2korap.xsl b/nkjp2korap.xsl
new file mode 100644
index 0000000..3feeac9
--- /dev/null
+++ b/nkjp2korap.xsl
@@ -0,0 +1,25 @@
+<?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">
+
+
+ <!-- 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>
+ <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:element>
+ </xsl:document>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/test/nkjp2korap.xspec b/test/nkjp2korap.xspec
new file mode 100644
index 0000000..db0e732
--- /dev/null
+++ b/test/nkjp2korap.xspec
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec"
+ xmlns:functx="http://www.functx.com"
+ stylesheet="../nkjp2korap.xsl">
+
+ <!-- tests to check conversion of primary data -->
+ <x:scenario label="Check primary Data">
+
+ <!-- load example file -->
+ <x:context href="./resources/nkjp2korap_sample1/KOT/text.xml" />
+
+ <!-- test get-primary-data template -->
+ <x:call template="get-primary-data">
+ <x:param name="corpusID" select="'NKJP'" />
+ <x:param name="docID" select="'KOT'" />
+ <x:param name="textID" select="'00076'" />
+ </x:call>
+
+ <x:expect label="Check text" test="substring(//*[local-name()='text'],0,10) = 'Nie zdąży'" />
+
+ <x:expect label="Check text sigle" test="*[local-name()='raw_text']/@docid = 'NKJP_KOT.00076'" />
+
+ </x:scenario>
+</x:description>