Commits

Anonymous committed 6a8bbe3

Avoided the xmlns="" empty attribute in the output.

  • Participants
  • Parent commits 7c2fbf1

Comments (0)

Files changed (10)

XML-Grammar-Fortune/module/Changes

+        - avoided creating an xmlns="" attribute in the output of several
+        elements which caused the XHTML to be invalid.
+
 0.0104  Thu Aug 21 17:39:45 IDT 2008
         - Removed a binmode ":utf8" call from t/to-xhtml.t to settle
         XML-LibXML on Mandriva Cooker and elsewhere.

XML-Grammar-Fortune/module/extradata/fortune-xml-to-html.xslt

 <?xml version="1.0" encoding="utf-8" ?>
 <xsl:stylesheet version = '1.0'
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
-    
+    xmlns="http://www.w3.org/1999/xhtml"
      >
 
 <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
 
 <!-- The purpose of this function is to recursively copy elements without a
 namespace-->
-<xsl:template mode="copy-no-ns" match="*">
-    <xsl:element name="{local-name()}">
+<xsl:template mode="copy-html-ns" match="*">
+    <xsl:element xmlns="http://www.w3.org/1999/xhtml" name="{local-name()}">
         <xsl:copy-of select="@*"/>
-        <xsl:apply-templates mode="copy-no-ns"/>
+        <xsl:apply-templates mode="copy-html-ns"/>
+    </xsl:element>
+</xsl:template>
+
+<xsl:template name="copy_html_ns_by_name">
+    <xsl:element xmlns="http://www.w3.org/1999/xhtml" name="{local-name()}">
+            <xsl:copy-of select="@*" />
+            <xsl:call-template name="copy_html_ns_by_name">
+                <xsl:value-of select="./*" />
+            </xsl:call-template>
     </xsl:element>
 </xsl:template>
 
                 <xsl:apply-templates select="quote" />
             </xsl:when>
             <xsl:when test="screenplay">
-                <xsl:apply-templates select="screenplay" />
+                <xsl:apply-templates select="screenplay" mode="screenplay_wrapper"/>
             </xsl:when>
             
         </xsl:choose> 
 </xsl:template>
 
 <xsl:template match="quote">
-    <blockquote>
-        <xsl:apply-templates select="body/*" mode="copy-no-ns"/>
+    <blockquote xmlns="http://www.w3.org/1999/xhtml">
+        <xsl:apply-templates select="body/*" mode="copy-html-ns"/>
     </blockquote>
     <xsl:call-template name="render_info" select="." />
 </xsl:template>
     <xsl:call-template name="render_info" select="." />
 </xsl:template>
 
-<xsl:template match="screenplay">
+<xsl:template match="screenplay" mode="screenplay_wrapper">
+    <xsl:apply-templates select="." mode="screenplay_driver"/>
+</xsl:template>
+
+<xsl:template match="screenplay" mode="screenplay_driver">
     <div class="screenplay">
         <xsl:apply-templates select="body/*" mode="screenplay"/>
     </div>
     <xsl:call-template name="render_info" select="." />
 </xsl:template>
 
-
 <xsl:template match="*" name="raw_info_subs">
     <tr xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
         <td class="field">

XML-Grammar-Fortune/module/t/data/xhtml-results/quote-fort-sample-1.xhtml

 <body>
 <div class="fortune">
 <h3 id="the-american-lottery">The American Lottery</h3>
-<blockquote xmlns="">
+<blockquote>
 <p>The American Lottery - all you need is a dollar and a
 dream. We will take the dollar, but you can keep the
 dream.</p>

XML-Grammar-Fortune/module/t/data/xhtml-results/quote-fort-sample-2-with-brs.xhtml

 <body>
 <div class="fortune">
 <h3 id="the-american-lottery">I/O, I/O</h3>
-<blockquote xmlns="">
+<blockquote>
 <p>I/O, I/O,<br/>
 It's off to disk I go.</p>
 </blockquote>

XML-Grammar-Fortune/module/t/data/xhtml-results/quote-fort-sample-4-ul.xhtml

 <body>
 <div class="fortune">
 <h3 id="the-american-lottery">The American Lottery</h3>
-<blockquote xmlns="">
+<blockquote>
 <p>The American Lottery.</p>
 <ul>
 <li>It's best served cold.</li>

XML-Grammar-Fortune/module/t/data/xhtml-results/quote-fort-sample-5-ol.xhtml

 <body>
 <div class="fortune">
 <h3 id="the-american-lottery">The American Lottery</h3>
-<blockquote xmlns="">
+<blockquote>
 <p>The American Lottery.</p>
 <ul>
 <li>It's best served cold.</li>

XML-Grammar-Fortune/module/t/data/xhtml-results/quote-fort-sample-6-with-bold.xhtml

 <body>
 <div class="fortune">
 <h3 id="the-american-lottery">The American Lottery</h3>
-<blockquote xmlns="">
+<blockquote>
 <p>The American <b>Lottery</b>.</p>
 <ul>
 <li>It's best <b>served</b> cold.</li>

XML-Grammar-Fortune/module/t/data/xhtml-results/quote-fort-sample-7-with-italics.xhtml

 <body>
 <div class="fortune">
 <h3 id="the-american-lottery">The American Lottery</h3>
-<blockquote xmlns="">
+<blockquote>
 <p>The American <b>Lottery</b>.</p>
 <ul>
 <li>It's best <b>served</b> cold.</li>

XML-Grammar-Fortune/module/t/data/xhtml-results/quote-fort-sample-8-with-em-and-strong.xhtml

 <body>
 <div class="fortune">
 <h3 id="the-american-lottery">The American Lottery</h3>
-<blockquote xmlns="">
+<blockquote>
 <p>The American <b>Lottery</b>. All <em>you</em> need is a <strong>dollar</strong>.</p>
 <ul>
 <li>It's best <b>served</b> cold.</li>

XML-Grammar-Fortune/module/t/data/xhtml-results/screenplay-fort-sample-1.xhtml

 <body>
 <div class="fortune">
 <h3 id="david-and-goliath-1">David and Goliath - 1</h3>
-<div xmlns="" class="screenplay">
+<div class="screenplay">
 <div class="description">
 <p>[
 David and