]> granicus.if.org Git - docbook-dsssl/commitdiff
Fix the namespace fixup step to match the other stylesheets.
authorBob Stayton <bobs@sagehill.net>
Mon, 17 Feb 2014 18:03:34 +0000 (18:03 +0000)
committerBob Stayton <bobs@sagehill.net>
Mon, 17 Feb 2014 18:03:34 +0000 (18:03 +0000)
xsl/epub/docbook.xsl

index ee2df6dcd770a7f9b71848ca1798eb1779d34ecc..6c96b898d94a38fb2b3df2b81f61645d7b8488fa 100644 (file)
       <xsl:call-template name="get.doc.title" />
     </xsl:variable>
     <xsl:choose>
-      <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
-        toss the namespace and continue.  Use the docbook5 namespaced
-        stylesheets for DocBook5 if you don't want to use this feature.-->
-      <!-- include extra test for Xalan quirk -->
-      <xsl:when test="$exsl.node.set.available != 0
-                    and (*/self::ng:* or */self::db:*)">
+      <!-- fix namespace if necessary -->
+      <xsl:when test="$exsl.node.set.available != 0 and 
+                    namespace-uri(/*) = 'http://docbook.org/ns/docbook'">
         <xsl:call-template name="log.message">
           <xsl:with-param name="level">Note</xsl:with-param>
-          <xsl:with-param name="source" select="$doc.title" />
+          <xsl:with-param name="source" select="$doc.title"/>
           <xsl:with-param name="context-desc">
             <xsl:text>namesp. cut</xsl:text>
           </xsl:with-param>
             <xsl:text>stripped namespace before processing</xsl:text>
           </xsl:with-param>
         </xsl:call-template>
-        <xsl:variable name="nons">
-          <xsl:apply-templates mode="stripNS" />
-        </xsl:variable>
-        <xsl:call-template name="log.message">
-          <xsl:with-param name="level">Note</xsl:with-param>
-          <xsl:with-param name="source" select="$doc.title" />
-          <xsl:with-param name="context-desc">
-            <xsl:text>namesp. cut</xsl:text>
-          </xsl:with-param>
-          <xsl:with-param name="message">
-            <xsl:text>processing stripped document</xsl:text>
+        <!-- DEBUG: uncomment to save namespace-fixed document.
+        <xsl:message>Saving namespace-fixed document.</xsl:message>
+        <xsl:call-template name="write.chunk">
+          <xsl:with-param name="filename" select="'namespace-fixed.debug.xml'"/>
+          <xsl:with-param name="method" select="'xml'"/>
+          <xsl:with-param name="content">
+            <xsl:copy-of select="exsl:node-set($no.namespace)"/>
           </xsl:with-param>
         </xsl:call-template>
-        <xsl:apply-templates select="exsl:node-set($nons)" />
+        -->
+        <xsl:apply-templates select="exsl:node-set($no.namespace)"/>
+      </xsl:when>
+      <!-- Can't process unless namespace fixed with exsl node-set()-->
+      <xsl:when test="namespace-uri(/*) = 'http://docbook.org/ns/docbook'">
+        <xsl:message terminate="yes">
+          <xsl:text>Unable to strip the namespace from DB5 document,</xsl:text>
+          <xsl:text> cannot proceed.</xsl:text>
+        </xsl:message>
       </xsl:when>
       <xsl:otherwise>
         <xsl:choose>