]> granicus.if.org Git - docbook-dsssl/commitdiff
Adjust handling of namespace fixup to streamline distro builds.
authorBob Stayton <bobs@sagehill.net>
Wed, 29 Jan 2014 02:55:52 +0000 (02:55 +0000)
committerBob Stayton <bobs@sagehill.net>
Wed, 29 Jan 2014 02:55:52 +0000 (02:55 +0000)
xsl/html/chunk-code.xsl
xsl/html/chunk-common.xsl
xsl/html/chunktoc.xsl

index 04aea32e962e7341b03092e9c16ed5d3d5bb5ea4..6cb08c7181828ce4bf9552873b7c7d64b93e93d2 100644 (file)
@@ -2,9 +2,7 @@
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:exsl="http://exslt.org/common"
                 xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0"
-                xmlns:ng="http://docbook.org/docbook-ng"
-                xmlns:db="http://docbook.org/ns/docbook"
-                exclude-result-prefixes="exsl cf ng db"
+                exclude-result-prefixes="exsl cf"
                 version="1.0">
 
 <!-- ********************************************************************
     <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.-->
-    <xsl:when test="$exsl.node.set.available != 0 
-                    and (*/self::ng:* or */self::db:*)">
-
+    <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:text>namesp. cut</xsl:text>
         </xsl:with-param>
         <xsl:with-param name="message">
-          <xsl:text>processing stripped document</xsl:text>
+          <xsl:text>stripped namespace before processing</xsl:text>
         </xsl:with-param>
       </xsl:call-template>
 
       <xsl:apply-templates select="exsl:node-set($no.namespace)"/>
     </xsl:when>
-    <!-- Can't process unless namespace removed -->
-    <xsl:when test="*/self::ng:* or */self::db:*">
+    <!-- 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>
index 9dc17185d4738ce19deb8267120341da3e73c5ea..2ff46025522bf27ca45ddce9c49ca8a89cd4e117 100644 (file)
@@ -1,10 +1,8 @@
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:exsl="http://exslt.org/common"
                 xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0"
-                xmlns:ng="http://docbook.org/docbook-ng"
-                xmlns:db="http://docbook.org/ns/docbook"
                 version="1.0"
-                exclude-result-prefixes="exsl cf ng db">
+                exclude-result-prefixes="exsl cf">
 
 <!-- ********************************************************************
      $Id$
 <xsl:variable name="chunk.hierarchy">
   <xsl:if test="$chunk.fast != 0">
     <xsl:choose>
-      <!-- Are we handling a docbook5 document? -->
-      <xsl:when test="$exsl.node.set.available != 0
-                      and (*/self::ng:* or */self::db:*)">
+      <!-- Do we need to fix namespace? -->
+      <xsl:when test="$exsl.node.set.available != 0 and 
+                    namespace-uri(/*) = 'http://docbook.org/ns/docbook'">
         <xsl:if test="$chunk.quietly = 0">
-          <xsl:message>Computing stripped namespace chunks...</xsl:message>
+          <xsl:message>Computing chunks...</xsl:message>
         </xsl:if>
         <xsl:apply-templates mode="find.chunks" select="exsl:node-set($no.namespace)"/>
       </xsl:when>
@@ -41,7 +39,6 @@
         <xsl:if test="$chunk.quietly = 0">
           <xsl:message>Computing chunks...</xsl:message>
         </xsl:if>
-
         <xsl:apply-templates select="/*" mode="find.chunks"/>
       </xsl:when>
       <xsl:otherwise>
index 6fc6365172a2f63ff8dfa9d63f0aa068c8ed7821..1a375a4a1a32dc14f99b44cb739fdd30632bdfa6 100644 (file)
@@ -1,9 +1,7 @@
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
-                xmlns:db="http://docbook.org/ns/docbook"
-                xmlns:ng="http://docbook.org/docbook-ng"
                version="1.0"
-                exclude-result-prefixes="doc db ng">
+                exclude-result-prefixes="doc">
 
 <!-- ********************************************************************
      $Id$
         <xsl:text>The chunk.toc file is not set.</xsl:text>
       </xsl:message>
     </xsl:when>
-    <!-- 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:*)">
+    <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: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>
-        </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 removed -->
-    <xsl:when test="*/self::ng:* or */self::db:*">
+    <!-- Can't process unless namespace is correct -->
+    <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>