proof of concept that I'm reaching for the right info
Change-Id: I851a6a89152d8984a01d38a0792a93fd6b8a071b
diff --git a/nkjp2korap.xsl b/nkjp2korap.xsl
index 2a94615..5b19e00 100644
--- a/nkjp2korap.xsl
+++ b/nkjp2korap.xsl
@@ -1,8 +1,10 @@
 <?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:nkjp="http://www.nkjp.pl/ns/1.0"
+                xmlns:tei="http://www.tei-c.org/ns/1.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">
+                exclude-result-prefixes="xs f map nkjp tei" version="3.0" expand-text="yes">
 
   <xsl:param name="corpusID"/>
   <xsl:param name="docID"/>
@@ -26,6 +28,19 @@
         </text>
       </xsl:element>
     </xsl:result-document>
+    
+    <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 || '/header.xml'}" 
+      doctype-public="-//IDS//DTD IDS-XCES 1.0//EN" doctype-system="http://corpora.ids-mannheim.de/idsxces1/DTD/ids.xcesdoc.dtd">
+      
+      <idsHeader type="document" pattern="text" status="new" version="1.1" TEIform="teiHeader">
+        <xsl:copy-of select="$text.xml//tei:TEI/tei:teiHeader/tei:fileDesc"/>
+      </idsHeader>
+      
+      <xsl:copy>
+        
+      </xsl:copy>
+    </xsl:result-document>
 
   </xsl:template>
 
diff --git a/test/output/NKJP/NKJP/KOT/header.xml b/test/output/NKJP/NKJP/KOT/header.xml
index e69de29..f40fa68 100644
--- a/test/output/NKJP/NKJP/KOT/header.xml
+++ b/test/output/NKJP/NKJP/KOT/header.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE idsHeader
+  PUBLIC "-//IDS//DTD IDS-XCES 1.0//EN" "http://corpora.ids-mannheim.de/idsxces1/DTD/ids.xcesdoc.dtd">
+<idsHeader type="document"
+           pattern="text"
+           status="new"
+           version="1.1"
+           TEIform="teiHeader">
+   <fileDesc xmlns="http://www.tei-c.org/ns/1.0"
+             xmlns:nkjp="http://www.nkjp.pl/ns/1.0"
+             xmlns:xi="http://www.w3.org/2001/XInclude">
+      <titleStmt>
+         <title>TEI P5 encoded version of sample(s) of "Kot"</title>
+      </titleStmt>
+      <extent nkjp:file="text.xml">
+         <num type="word" value="4892"/>
+      </extent>
+      <publicationStmt nkjp:subcorpus="one_million">
+         <availability status="free" default="false">
+            <p>See the licence agreement.</p>
+         </availability>
+      </publicationStmt>
+      <sourceDesc default="false">
+         <bibl xml:id="h_src-bibl" default="false">
+            <title xml:lang="pl">Kot (agregat)</title>
+            <idno type="nkjp">IJPPAN_4scal-KOT</idno>
+            <note type="text_origin" anchored="true">IJP PAN</note>
+         </bibl>
+         <listBibl default="false">
+            <bibl xml:id="h_76-bibl" default="false">
+               <ptr target="#txt_76-div"/>
+               <idno type="para">p55in262</idno>
+            </bibl>
+         </listBibl>
+      </sourceDesc>
+   </fileDesc>
+</idsHeader>