]> granicus.if.org Git - docbook-dsssl/commitdiff
Add DocBook subjectset -> OPF dc:subject mapping and tests
authorKeith Fahlgren <abdelazer@users.sourceforge.net>
Fri, 10 Apr 2009 02:37:59 +0000 (02:37 +0000)
committerKeith Fahlgren <abdelazer@users.sourceforge.net>
Fri, 10 Apr 2009 02:37:59 +0000 (02:37 +0000)
xsl/epub/bin/spec/epub_realbook_spec.rb
xsl/epub/bin/spec/files/orm.book.001.xml
xsl/epub/docbook.xsl

index 837e6e4e434781d0abbfb6d95a6c7918d34aba2b..fd0f571c8d38a5811ca29c6cbbbfcbb807b73f13 100755 (executable)
@@ -86,6 +86,11 @@ describe DocBook::Epub do
     @opf_lines.to_s.should =~ /date[^>]+>2008-04-15</
   end
 
+  it "should use the <subjectset> as dc:subject for the 'Real Book' test document #{@xml_file}" do
+    @opf_lines.to_s.should =~ /subject[^>]+>COM018000</
+  end
+
+
 
   after(:all) do
     FileUtils.rm_r(@tmpdir, :force => true)
index f3f1f27106935efb4e90ffe5cb3d79bc7e3b63f1..484051b5ac75f8be02e8f2d826c67d5e6eba70ec 100644 (file)
@@ -12,6 +12,7 @@
         <para>Rxxxxxx Dxxx xx x xxxxxxxxx xxxxxx xxxxxxxxxxxx xx MxSQL xxxxxxxx xxxxxxxx xxx xx xxx xxxxxx xx xxx MxSQL Kxxxxxxxx Bxxx (xxxx://xxx.xxxxx.xxx/xxxxxxx/xxxxxxxxxxxxx.xxxx). Hx xx xxx xxxxxx xx MxSQL xx x Nxxxxxxx (xxxx://xxx.xxxxxxx.xxx/xxxxxxx/xxxxxxxx/) xxx xxx xxxxxx xxxxxxxx xxx xxxxxxx xxxxxxxxx: Dxx Zxxx (x MxSQL xxxxxxxxxxx), Lxxxx Jxxxxxx, ONxxxx.xxx, Txx Pxxx Jxxxxxx, Rxx Hxx Mxxxxxxx, SxxAxxxx Mxxxxxxx, Txxx Rxxxxxxx, Uxxx Rxxxxx, xxx XML.xxx. Hx xxx xxxx xxxxxxxx xxx xxxxx xxxxx, “Ix Sxxxxx xx Kxxxx”. Mxxx xxxxxxxxxxx xx Rxxxxxx, xxxxx xxxx x xxxx xx xxx xxxxxxxxx xxxxxxxx xxxx xxxxx xx xxxx, xxx xx xxxxx xx xxx xxx xxxx xx xxxx://xxxxxxx.xxxxxxxxx.xxx</para>
       </authorblurb>
     </author>
+    <subjectset><subject><subjectterm>COM018000</subjectterm></subject></subjectset>
     <editor>
       <firstname>Axxx</firstname>
       <surname>Oxxx</surname>
index 6db93909ffad800ca30b933827b2c59621991f86..b6fd618212fdf26fbf9fe8a4f337db0cb7378cb4 100644 (file)
     </xsl:element>
   </xsl:template>
 
+  <xsl:template match="subjectset" mode="opf.metadata">
+    <xsl:apply-templates select="subject/subjectterm" mode="opf.metadata"/>
+  </xsl:template>
+  
+  <xsl:template match="subjectterm" mode="opf.metadata">
+    <xsl:element name="dc:subject">
+      <xsl:value-of select="normalize-space(string(.))"/>
+    </xsl:element>
+  </xsl:template>
+
   <xsl:template match="publisher" mode="opf.metadata">
     <xsl:apply-templates select="publishername" mode="opf.metadata"/>
   </xsl:template>