Commits

Anonymous committed 7a12906

Now implemented the handling of the <fic:title /> element.

Fixed some bugs.

Comments (0)

Files changed (2)

perl/modules/XML-Grammar-Fiction/extradata/fiction-xml-to-html.xslt

             </xsl:attribute>
         </xsl:if>
         <!-- Make the title the title attribute or "ID" if does not exist. -->
-        <xsl:element name="h{count(ancestor-or-self::fic:scene)}">
-            <xsl:value-of select="title" />
+        <xsl:element name="h{count(ancestor-or-self::fic:section|ancestor-or-self::fic:body)}">
+            <xsl:value-of select="fic:title" />
         </xsl:element>
         <xsl:apply-templates select="fic:section|fic:p" />
     </div>

perl/modules/XML-Grammar-Fiction/t/to-xhtml.t

 use strict;
 use warnings;
 
-use Test::More tests => 8;
+use Test::More tests => 12;
 
 use File::Spec;
 
         "Found role=description sections",
     );
 
+    {
+        my @elems = $xpc->findnodes(q{//x:div[@xml:id="top"]/x:h2}, $doc);
+        # TEST*$num_texts
+        is (scalar(@elems), 1, "One element");
+
+        # TEST*$num_texts
+        is ($elems[0]->textContent(), "The Top Section", 
+            "<h2> element contains the right thing.");
+    }
 
     # TEST:$num_with_styles=1;
     if ($fn eq "sections-p-b-i")