]> granicus.if.org Git - docbook-dsssl/commitdiff
Added regression test and fix for XHTML validation problem with <a>s added inside...
authorKeith Fahlgren <abdelazer@users.sourceforge.net>
Fri, 6 Mar 2009 04:48:04 +0000 (04:48 +0000)
committerKeith Fahlgren <abdelazer@users.sourceforge.net>
Fri, 6 Mar 2009 04:48:04 +0000 (04:48 +0000)
xsl/epub/bin/spec/epub_regressions_spec.rb
xsl/epub/bin/spec/files/blockquotepre.xml [new file with mode: 0644]
xsl/xhtml-1_1/html2xhtml.xsl
xsl/xhtml/html2xhtml.xsl

index 1b152b3c41105f188dd6166f43b3184c37f64505..cc679ddffd9f4420ab962283ac952ea037d5f00e 100755 (executable)
@@ -109,6 +109,13 @@ describe DocBook::Epub do
     opf_lns.to_s.should =~ /reference[^>]+type=['"]cover['"]/
   end
 
+  it "should allow pre elements inside blockquotes" do
+    blockquotepre_epub = DocBook::Epub.new(File.join(@filedir, "blockquotepre.xml"), @tmpdir)
+    blockquotepre_epubfile  = File.join(@tmpdir, "blockquotepreepub.epub")
+    blockquotepre_epub.render_to_file(blockquotepre_epubfile, $DEBUG)
+    blockquotepre_epubfile.should be_valid_epub  
+  end
+
   after(:all) do
     FileUtils.rm_r(@tmpdir, :force => true)
   end  
diff --git a/xsl/epub/bin/spec/files/blockquotepre.xml b/xsl/epub/bin/spec/files/blockquotepre.xml
new file mode 100644 (file)
index 0000000..2d433cc
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
+<sect1><title>Blockquote with pre test</title>
+ <blockquote>
+        <para><emphasis>Definition:</emphasis> Let <emphasis>A, B</emphasis>,
+        . . . <emphasis>, Z</emphasis> be subsets of the heading of relvar
+        <emphasis>R</emphasis>. Then <emphasis>R</emphasis> satisfies the
+        <emphasis>join dependency</emphasis> (JD<indexterm id="IDX-CHP-7-0533" significance="normal"><primary>JD</primary></indexterm>)</para>
+        <programlisting format="linespecific" id="I_7_tt242">{ <emphasis>A</emphasis>, <emphasis>B</emphasis>, ..., <emphasis>Z</emphasis> }
+</programlisting>
+        <para>if and only if every relation that's a legal value for
+        <emphasis>R</emphasis> is equal to the join of its projections on
+        <emphasis>A, B</emphasis>, . . . <emphasis>, Z</emphasis>.</para>
+      </blockquote>
+</sect1>
index 209a4df84a834c8ae2fba0313ab43be314179f7f..d125605042ddb2c8fe6a2d00f2bcfddaae7178ed 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0"?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:exsl="http://exslt.org/common"
+                xmlns:xslo="http://www.w3.org/1999/XSL/TransformAlias"
                 xmlns:saxon="http://icl.com/saxon"
                 exclude-result-prefixes="exsl"
                 version="1.0">
@@ -11,6 +12,7 @@
   saxon:character-representation="decimal"
   />
 <xsl:preserve-space elements="*"/>
+<xsl:namespace-alias stylesheet-prefix="xslo" result-prefix="xsl"/>
 
 <xsl:template match="/">
   <xsl:comment>This file was created automatically by html2xhtml</xsl:comment>
   </xsl:copy>
 </xsl:template>
 
+<!-- Bare anchors (<a/>) are not allowed in <blockquote>s -->
+<xsl:template match="xsl:template[@name='anchor']/xsl:if">
+  <xslo:if>
+    <xsl:attribute name="test">
+      <xsl:text>not($node[parent::blockquote])</xsl:text>
+    </xsl:attribute>
+    <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates/>
+    </xsl:copy>
+  </xslo:if>
+</xsl:template>
+
 <xsl:template match="xsl:template[@name='body.attributes']">
   <xsl:copy>
     <xsl:copy-of select="@*"/>
index fce9f5d0aa1fe40d6d905be7a5802b0c5e224b41..0de1517cb2168c8e086614687c6bae52cf50fe47 100644 (file)
   </xsl:copy>
 </xsl:template>
 
+<!-- Bare anchors (<a/>) are not allowed in <blockquote>s -->
+<xsl:template match="xsl:template[@name='anchor']/xsl:if">
+  <xslo:if>
+    <xsl:attribute name="test">
+      <xsl:text>not($node[parent::blockquote])</xsl:text>
+    </xsl:attribute>
+    <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates/>
+    </xsl:copy>
+  </xslo:if>
+</xsl:template>
+
 <xsl:template match="xsl:template[@name='body.attributes']">
   <xsl:copy>
     <xsl:copy-of select="@*"/>