Fix for dc:creator and dc:date tag – make it as described in OPF 2.0.1 spec.
authorRobert Błaut <listy@blaut.biz>
Sun, 26 Jan 2014 16:20:13 +0000 (17:20 +0100)
committerRobert Błaut <listy@blaut.biz>
Sun, 26 Jan 2014 16:20:13 +0000 (17:20 +0100)
According to an example from OPF 2.0.1 spec:
<dc:creator opf:file-as="King, Martin Luther Jr." opf:role="aut">
        Rev. Dr. Martin Luther King Jr.
</dc:creator>

Regarding to dc:date change: Sigil throws  with xsi:type in dc:date.

librarian/epub/xsltContent.xsl

index 83eb376..8de0259 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/">
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wl="http://wolnelektury.pl/functions">
   <xsl:output method="html" version="1.0" omit-xml-declaration="no" />
 
   <xsl:template match="/">
   <xsl:output method="html" version="1.0" omit-xml-declaration="no" />
 
   <xsl:template match="/">
         <dc:subject>
           <xsl:apply-templates select="//dc:identifier.url" />
         </dc:subject>
         <dc:subject>
           <xsl:apply-templates select="//dc:identifier.url" />
         </dc:subject>
-        <dc:creator>
-          <xsl:apply-templates select="//dc:creator" />
+        <dc:creator opf:role="aut">
+               <xsl:attribute name="opf:file-as">
+               <xsl:value-of select="//dc:creator" />
+            </xsl:attribute>
+            <xsl:apply-templates select="//dc:creator" mode="person"/>
         </dc:creator>
         <dc:publisher>
           <xsl:apply-templates select="//dc:publisher" />
         </dc:publisher>
         </dc:creator>
         <dc:publisher>
           <xsl:apply-templates select="//dc:publisher" />
         </dc:publisher>
-        <dc:date xsi:type="dcterms:W3CDTF">
+        <dc:date opf:event="publication">
           <xsl:apply-templates select="//dc:date" />
         </dc:date>
       </metadata>
           <xsl:apply-templates select="//dc:date" />
         </dc:date>
       </metadata>
@@ -46,5 +49,9 @@
       <xsl:value-of select="." />
     </dc:title>
   </xsl:template>
       <xsl:value-of select="." />
     </dc:title>
   </xsl:template>
+  
+  <xsl:template match="text()" mode="person">
+    <xsl:value-of select="wl:person_name(.)" />
+  </xsl:template>
 
 </xsl:stylesheet>
 
 </xsl:stylesheet>